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
Fix race condition in free-threaded Python (fixes issue #867) (#887)
* Fix race condition in free-threaded Python (fixes issue #867)
This commit addresses an issue arising when multiple threads want to
access the Python object associated with the same C++ instance, which
does not exist yet and therefore must be created. @vfdev-5 reported that
TSAN detects a race condition in code that uses this pattern, caused by
concurrent unprotected reads/writes of internal ``nb_inst`` fields.
To fix this issue, we split instance creation and registration into
a two-step process. The latter is only done when the object is fully
constructed.
* Added test case for issue #867
---------
Co-authored-by: vfdev-5 <[email protected]>
0 commit comments