mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Issue #15781: Fix two small race conditions in import's module locking.
This commit is contained in:
parent
30147710e8
commit
0398985920
5 changed files with 3679 additions and 3655 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue