summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-18 22:18:17 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-18 22:18:17 +0100
commit3e649a7c94605a4fe97596657e03644931ba9df2 (patch)
treee101db3b482e623b552dcc99b5e02b9e724d80be /Python
parent40929f315c0bb0f7feb4a5204bafa9f6dd7160f7 (diff)
downloadcpython-3e649a7c94605a4fe97596657e03644931ba9df2.tar.gz
Add sanity assertions in some import lock code (issue #15599).
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 2f71b97bc8..5fc2523b26 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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);