Skip to content

Commit 9de6d1a

Browse files
committed
Use _PyCriticalSection_BeginSlow
1 parent 5e7d423 commit 9de6d1a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/pybind11/detail/internals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ class pycritical_section {
249249
# if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x030E00C1 // 3.14.0rc1
250250
PyCriticalSection_BeginMutex(&cs, &mutex.mutex);
251251
# else
252-
_PyCriticalSection_BeginMutex(_PyThreadState_GET(), &cs, &mutex.mutex);
252+
// Use the slow path of internal API `_PyCriticalSection_BeginMutex` for older versions
253+
_PyCriticalSection_BeginSlow(&cs, &mutex.mutex);
253254
# endif
254255
}
255256
~pycritical_section() { PyCriticalSection_End(&cs); }

0 commit comments

Comments
 (0)