The Python interface is almost the same as in D3990. I just renamed add/remove to register/unregister and added a new is_registered method.
- support for non-persistent callbacks
Non-persistent callbacks are the default now, so they will be unregistered when a new file is loaded.
Instead of making an persistent decorator, I made this a new argument to the register function to make it easier to use.
I can also make it a decorator to conform with bpy.app.handlers however I think making it a parameter is the better solution.
Generally seems fine, made some minor changes.
One thing that seems odd is how the Python API uses the identifier.
Why not have the Python function it's self be the unique handle thats used to register?
Made a patch for this, see: P837 (uses uintptr_t, could also use const void *).
For most C users, they can use any pointer as the handle to register/unregister.
The function pointer when there is only ever one instance can work or a memory pointer they own would also be fine.