8000 gh-108520: Fix bad fork detection in nested multiprocessing use case by albanD · Pull Request #108568 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-108520: Fix bad fork detection in nested multiprocessing use case #108568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup test code
  • Loading branch information
albanD committed Aug 30, 2023
commit 1b62ab02d61e75a7bbcda20e21ba0d36007fb09a
25 changes: 14 additions & 11 deletions Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5342,16 +5342,6 @@ def test_ignore_listener(self):
finally:
conn.close()

# Utility functions used as target for spawn Process
def put_one_in_queue(queue):
queue.put(1)

def put_two_and_nest_once(queue):
queue.put(2)
process = multiprocessing.Process(target=put_one_in_queue, args=(queue,))
process.start()
process.join()

class TestStartMethod(unittest.TestCase):
@classmethod
def _check_context(cls, conn):
Expand Down Expand Up @@ -5453,10 +5443,23 @@ def test_mixed_startmethod(self):
p.start()
p.join()

@classmethod
def _put_one_in_queue(cls, queue):
queue.put(1)

@classmethod
def _put_two_and_nest_once(cls, queue):
queue.put(2)
process = multiprocessing.Process(target=cls._put_one_in_queue, args=(queue,))
process.start()
process.join()

def test_nested_startmethod(self):
# gh-108520: Regression test to ensure that child process can send its
# arguments to another process
queue = multiprocessing.Queue()

process = multiprocessing.Process(target=put_two_and_nest_once, args=(queue,))
process = multiprocessing.Process(target=self._put_two_and_nest_once, args=(queue,))
process.start()
process.join()

Expand Down
0