Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-38707: Fix for multiprocessing.Process MainThread.native_id #17088

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
Nov 19, 2019
Prev Previous commit
Next Next commit
Add multiprocessing native_id test
  • Loading branch information
jaketesler committed Nov 8, 2019
commit c98cca0890c9bdee856a51a0f82df0e59072d069
18 changes: 18 additions & 0 deletions 18 Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,24 @@ def test_process(self):
self.assertNotIn(p, self.active_children())
close_queue(q)

if threading._HAVE_THREAD_NATIVE_ID:
jaketesler marked this conversation as resolved.
Show resolved Hide resolved
def test_process_thread_attributes(self):
current_mainthread_native_id = threading.main_thread().native_id

q = self.Queue(1)
p = self.Process(target=self._test_process_thread_attributes, args=(q,))
p.daemon = True
p.start()

child_mainthread_native_id = q.get()
self.assertNotEqual(current_mainthread_native_id, child_mainthread_native_id)
close_queue(q)

@classmethod
def _test_process_thread_attributes(cls, q):
mainthread_native_id = threading.main_thread().native_id
q.put(mainthread_native_id)

@classmethod
def _sleep_some(cls):
time.sleep(100)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.