File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -260,8 +260,15 @@ _PyCriticalSection_AssertHeld(PyMutex *mutex)
260260{
261261#ifdef Py_DEBUG
262262 PyThreadState * tstate = _PyThreadState_GET ();
263- _PyCriticalSection * cs = (_PyCriticalSection * )tstate -> critical_section ;
264- assert (cs != NULL && cs -> mutex == mutex );
263+ uintptr_t prev = tstate -> critical_section ;
264+ if (prev & _Py_CRITICAL_SECTION_TWO_MUTEXES ) {
265+ _PyCriticalSection2 * cs = (_PyCriticalSection2 * )(prev & ~_Py_CRITICAL_SECTION_MASK );
266+ assert (cs != NULL && (cs -> base .mutex == mutex || cs -> mutex2 == mutex ));
267+ } else {
268+ _PyCriticalSection * cs = (_PyCriticalSection * )(tstate -> critical_section & ~_Py_CRITICAL_SECTION_MASK );
269+ assert (cs != NULL && cs -> mutex == mutex );
270+ }
271+
265272#endif
266273}
267274
You can’t perform that action at this time.
0 commit comments