SIGN IN SIGN UP

gh-145235: Make dict watcher API thread-safe for free-threaded builds (gh-145233)

In free-threaded builds, concurrent calls to PyDict_AddWatcher, PyDict_ClearWatcher, PyDict_Watch, and PyDict_Unwatch can race on the shared callback array and the per-dict watcher tags. This change adds a mutex to serialize watcher registration and removal, atomic operations for tag updates, and atomic acquire/release synchronization for callback dispatch in _PyDict_SendEvent.
A
Alper committed
8a4895985f42282504d83b9bd0c77b129f95a5d5
Parent: fadd9bc
Committed by GitHub <noreply@github.com> on 5/11/2026, 3:39:55 PM