summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threaded_import.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-08-27 22:24:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-08-27 22:24:52 (GMT)
commit4f0338cab745c8678df4113f2fcd38dd234a73f8 (patch)
tree9e8d59aa1480b43eb818f2510d2c105500b99960 /Lib/test/test_threaded_import.py
parent79dbded0fae7c1c10454a391ae3ebbb39c5b7a0f (diff)
downloadcpython-4f0338cab745c8678df4113f2fcd38dd234a73f8.zip
cpython-4f0338cab745c8678df4113f2fcd38dd234a73f8.tar.gz
cpython-4f0338cab745c8678df4113f2fcd38dd234a73f8.tar.bz2
Issue #15781: Fix two small race conditions in import's module locking.
Diffstat (limited to 'Lib/test/test_threaded_import.py')
-rw-r--r--Lib/test/test_threaded_import.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index f540bdc..cfc6842 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -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()