Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 80936:7cfca9ede861
Add sanity assertions in some import lock code (issue #15599).
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Tue, 18 Dec 2012 22:18:58 +0100 |
| parents | 4c8d756196a4 1ee9cf5a5351 |
| children | 6c0fca49b0fd |
line wrap: on
line diff
--- a/Python/import.c Tue Dec 18 23:16:44 2012 +0200 +++ b/Python/import.c Tue Dec 18 22:18:58 2012 +0100 @@ -169,6 +169,7 @@ 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 @@ 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);
