gh-127582: Make object resurrection thread-safe for free threading. (GH-127612)
Objects may be temporarily "resurrected" in destructors when calling finalizers or watcher callbacks. We previously undid the resurrection by decrementing the reference count using `Py_SET_REFCNT`. This was not thread-safe because other threads might be accessing the object (modifying its reference count) if it was exposed by the finalizer, watcher callback, or temporarily accessed by a racy dictionary or list access. This adds internal-only thread-safe functions for temporary object resurrection during destructors.
S
Sam Gross committed
f4f530804b9d8f089eba0f157ec2144c03b13651
Parent: 657d0e9
Committed by GitHub <noreply@github.com>
on 12/5/2024, 9:07:31 PM