SIGN IN SIGN UP

[3.13] gh-127582: Make object resurrection thread-safe for free threading. (GH-127612) (GH-127659)

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.
(cherry picked from commit f4f530804b9d8f089eba0f157ec2144c03b13651)
S
Sam Gross committed
69bb1c6c41c9840e4ae9537ff3e8e6eef718a0a8
Parent: 304111e
Committed by GitHub <noreply@github.com> on 12/5/2024, 11:49:33 PM