summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-18 21:18:17 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-18 21:18:17 (GMT)
commit202b60640bd873f00ee121cb24ee4a6409eb8993 (patch)
treeb68efa0e9ea52da603ab0baa80481502d356f689 /Python/import.c
parent5b89840d9cf11014a4b865d79497649f74bf2866 (diff)
downloadcpython-202b60640bd873f00ee121cb24ee4a6409eb8993.zip
cpython-202b60640bd873f00ee121cb24ee4a6409eb8993.tar.gz
cpython-202b60640bd873f00ee121cb24ee4a6409eb8993.tar.bz2
Add sanity assertions in some import lock code (issue #15599).
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 2f71b97..5fc2523 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);