diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-06 20:17:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-06 20:17:25 (GMT) |
commit | 233e6988f4b439f160732dd5b55e9d1a06a64b47 (patch) | |
tree | 2993c887aa884212112cccfbb39cfe186c77b1f0 /Lib/test/test_multiprocessing.py | |
parent | f050648a505b3810b659ca490c2e418a02c702cc (diff) | |
download | cpython-233e6988f4b439f160732dd5b55e9d1a06a64b47.zip cpython-233e6988f4b439f160732dd5b55e9d1a06a64b47.tar.gz cpython-233e6988f4b439f160732dd5b55e9d1a06a64b47.tar.bz2 |
Issue #22853: Fixed a deadlock when use multiprocessing.Queue at import time.
Patch by Florian Finkernagel and Davin Potts.
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
-rw-r--r-- | Lib/test/test_multiprocessing.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index ec4507e..b1e75b5 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -620,6 +620,26 @@ class _TestQueue(BaseTestCase): for p in workers: p.join() + def test_no_import_lock_contention(self): + with test_support.temp_cwd(): + module_name = 'imported_by_an_imported_module' + with open(module_name + '.py', 'w') as f: + f.write("""if 1: + import multiprocessing + + q = multiprocessing.Queue() + q.put('knock knock') + q.get(timeout=3) + q.close() + """) + + with test_support.DirsOnSysPath(os.getcwd()): + try: + __import__(module_name) + except Queue.Empty: + self.fail("Probable regression on import lock contention;" + " see Issue #22853") + # # # |