diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-09-29 16:10:40 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-09-29 16:10:40 (GMT) |
commit | c54960723faf89f5222cd695015f8aa4791031c6 (patch) | |
tree | 45128d5d10bdb1b8a0069cf43cd2aaddd2138a9b /Lib/test | |
parent | 61f901c8825e4bcbc5cee45ab0b29111d67e5e86 (diff) | |
download | cpython-c54960723faf89f5222cd695015f8aa4791031c6.zip cpython-c54960723faf89f5222cd695015f8aa4791031c6.tar.gz cpython-c54960723faf89f5222cd695015f8aa4791031c6.tar.bz2 |
Issue #19112: avoid using function defined in method.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_multiprocessing.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index dc4252e..579229a 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -2287,12 +2287,19 @@ class TestInitializers(unittest.TestCase): # Verifies os.close(sys.stdin.fileno) vs. sys.stdin.close() behavior # -def _ThisSubProcess(q): +def _this_sub_process(q): try: item = q.get(block=False) except Queue.Empty: pass +def _test_process(q): + queue = multiprocessing.Queue() + subProc = multiprocessing.Process(target=_this_sub_process, args=(queue,)) + subProc.daemon = True + subProc.start() + subProc.join() + def _afunc(x): return x*x @@ -2324,14 +2331,8 @@ class _file_like(object): class TestStdinBadfiledescriptor(unittest.TestCase): def test_queue_in_process(self): - def _TestProcess(q): - queue = multiprocessing.Queue() - subProc = multiprocessing.Process(target=_ThisSubProcess, args=(queue,)) - subProc.daemon = True - subProc.start() - subProc.join() queue = multiprocessing.Queue() - proc = multiprocessing.Process(target=_TestProcess, args=(queue,)) + proc = multiprocessing.Process(target=_test_process, args=(queue,)) proc.start() proc.join() |