diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-09-29 16:29:56 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-09-29 16:29:56 (GMT) |
commit | 8b3f5aafd3e04e22dec6740b790ea1dbdc361768 (patch) | |
tree | abb2dd20c5574e98844f7526fd9712ed592fa4fe | |
parent | 72a98541f0938afb443ce924b7422f8dcfa1f1f9 (diff) | |
download | cpython-8b3f5aafd3e04e22dec6740b790ea1dbdc361768.zip cpython-8b3f5aafd3e04e22dec6740b790ea1dbdc361768.tar.gz cpython-8b3f5aafd3e04e22dec6740b790ea1dbdc361768.tar.bz2 |
Issue #19112: avoid using function defined in method.
-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 a19bca0..6d20782 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -3117,12 +3117,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 pyqueue.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 @@ -3156,14 +3163,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() |