Issue #15781: Fix two small race conditions in import's module locking.

This commit is contained in:
Antoine Pitrou 2012-08-28 00:24:52 +02:00
parent 30147710e8
commit 0398985920
5 changed files with 3679 additions and 3655 deletions

View file

@ -224,7 +224,17 @@ class ThreadedImportTests(unittest.TestCase):
@reap_threads
def test_main():
run_unittest(ThreadedImportTests)
old_switchinterval = None
try:
old_switchinterval = sys.getswitchinterval()
sys.setswitchinterval(0.00000001)
except AttributeError:
pass
try:
run_unittest(ThreadedImportTests)
finally:
if old_switchinterval is not None:
sys.setswitchinterval(old_switchinterval)
if __name__ == "__main__":
test_main()