diff Python/import.c @ 80935:1ee9cf5a5351 3.3

Add sanity assertions in some import lock code (issue #15599).
author Antoine Pitrou <solipsis@pitrou.net>
date Tue, 18 Dec 2012 22:18:17 +0100
parents ee0c0f1c1eb2
children 08ce30768003 7cfca9ede861
line wrap: on
line diff
--- a/Python/import.c	Tue Dec 18 21:26:36 2012 +0200
+++ b/Python/import.c	Tue Dec 18 22:18:17 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);