Fix C++ invokes being responsible for destroying python callbacks

* If the last refcount on a python lambda/temp function is released when a
  wrapping std::function is destroyed in a C++ invoke, we can't destroy it
  safely. Instead we queue up that decref and process it the next chance we're
  able (which is either when the current execution finishes for a python shell
  execution, or on the next function call which handles extensions).
This commit is contained in:
baldurk committed 2020-12-03 14:55:02 +00:00
1 parent 0d1f6e3940
commit 6bc4e007a0
3 files changed
+50 -11

No files matched your search

@@ -64,4 +64,12 @@ extern "C" void SetThreadBlocking(PyObject *global_handle, bool block)
{
}
extern "C" void QueueDecRef(PyObject *obj)
{
}
extern "C" void ProcessDecRefQueue()
{
}
REPLAY_PROGRAM_MARKER()