As part of upgrading to PyO3 v0.23.x, access topyclass-annotated types will no longer be implicitly synchronized against the Python GIL. Those pyclass-annotated types must now be Sync and provide that synchronization explicitly.
Several places in Pants use RefCell which is not Send/Sync by itself. This PR uses pyo3::sync::GILProtected to provide explicit synchronization against the GIL for those use cases. (Eventually, we may wish to not use GILProtected to enable use of the Python 3.13 "no GIL" free threaded build, but that day is not today.)
As part of upgrading to PyO3 v0.23.x, access to
pyclass
-annotated types will no longer be implicitly synchronized against the Python GIL. Thosepyclass
-annotated types must now beSync
and provide that synchronization explicitly.Several places in Pants use
RefCell
which is not Send/Sync by itself. This PR usespyo3::sync::GILProtected
to provide explicit synchronization against the GIL for those use cases. (Eventually, we may wish to not useGILProtected
to enable use of the Python 3.13 "no GIL" free threaded build, but that day is not today.)Migration guide