mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Add sanity assertions in some import lock code (issue #15599).
This commit is contained in:
@@ -169,6 +169,7 @@ _PyImport_AcquireLock(void)
|
||||
PyThread_acquire_lock(import_lock, 1);
|
||||
PyEval_RestoreThread(tstate);
|
||||
}
|
||||
assert(import_lock_level == 0);
|
||||
import_lock_thread = me;
|
||||
import_lock_level = 1;
|
||||
}
|
||||
@@ -182,6 +183,7 @@ _PyImport_ReleaseLock(void)
|
||||
if (import_lock_thread != me)
|
||||
return -1;
|
||||
import_lock_level--;
|
||||
assert(import_lock_level >= 0);
|
||||
if (import_lock_level == 0) {
|
||||
import_lock_thread = -1;
|
||||
PyThread_release_lock(import_lock);
|
||||
|
||||
Reference in New Issue
Block a user