You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the object we pass into the callback is dead (zero refcount), and if the callback raises an error we try to PyErr_WriteUnraisable with that object as context, which increfs and decrefs it, which recursively again tries to deallocate it, and we end up in infinite recursion and overflowing the stack.
There are various other ways a callback could trigger this issue. We shouldn't pass around dead objects; instead *_dealloc should temporarily resurrect it before calling the callback.
carljm
changed the title
raising an exception in a dict watcher callback will segfault on a DEALLOCATED event
raising an exception in a dict/code/function watcher callback will segfault on a DEALLOCATED event
Mar 3, 2023
Because the object we pass into the callback is dead (zero refcount), and if the callback raises an error we try to
PyErr_WriteUnraisable
with that object as context, which increfs and decrefs it, which recursively again tries to deallocate it, and we end up in infinite recursion and overflowing the stack.There are various other ways a callback could trigger this issue. We shouldn't pass around dead objects; instead
*_dealloc
should temporarily resurrect it before calling the callback.Linked PRs
The text was updated successfully, but these errors were encountered: