Commit 0e8fc2c2 authored by Richard Oudkerk's avatar Richard Oudkerk

Issue #19112: avoid using function defined in method.

parent 13169321
...@@ -3117,12 +3117,19 @@ class TestInitializers(unittest.TestCase): ...@@ -3117,12 +3117,19 @@ class TestInitializers(unittest.TestCase):
# Verifies os.close(sys.stdin.fileno) vs. sys.stdin.close() behavior # Verifies os.close(sys.stdin.fileno) vs. sys.stdin.close() behavior
# #
def _ThisSubProcess(q): def _this_sub_process(q):
try: try:
item = q.get(block=False) item = q.get(block=False)
except pyqueue.Empty: except pyqueue.Empty:
pass 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): def _afunc(x):
return x*x return x*x
...@@ -3156,14 +3163,8 @@ class _file_like(object): ...@@ -3156,14 +3163,8 @@ class _file_like(object):
class TestStdinBadfiledescriptor(unittest.TestCase): class TestStdinBadfiledescriptor(unittest.TestCase):
def test_queue_in_process(self): 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() queue = multiprocessing.Queue()
proc = multiprocessing.Process(target=_TestProcess, args=(queue,)) proc = multiprocessing.Process(target=_test_process, args=(queue,))
proc.start() proc.start()
proc.join() proc.join()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment