homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Batuhan Taskaya, vstinner
Date 2020年03月27日.16:29:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585326588.57.0.914054012686.issue40089@roundup.psfhosted.org>
In-reply-to
Content
_at_fork() has a bug: it creates a _DummyThread instead of a _MainThread. Example:
---
import os, _thread, threading, time
def fork_in_thread():
 pid = os.fork()
 if pid:
 # parent
 os._exit(0)
 # child process
 print(f"child process: {threading.current_thread()=}")
 print(f"child process: {threading._main_thread=}")
print(f"parent process: {threading.current_thread()=}")
print(f"parent process: {threading._main_thread=}")
_thread.start_new_thread(fork_in_thread, ())
# block the main thread: fork_in_thread() exit the process
time.sleep(60)
---
Output:
---
parent process: threading.current_thread()=<_MainThread(MainThread, started 139879200077632)>
parent process: threading._main_thread=<_MainThread(MainThread, started 139879200077632)>
child process: threading.current_thread()=<_DummyThread(Dummy-1, started daemon 139878980245248)>
child process: threading._main_thread=<_DummyThread(Dummy-1, started daemon 139878980245248)>
---
My PR 19191 fix the issue:
---
parent process: threading.current_thread()=<_MainThread(MainThread, started 140583665170240)>
parent process: threading._main_thread=<_MainThread(MainThread, started 140583665170240)>
child process: threading.current_thread()=<_MainThread(MainThread, started 140583445075712)>
child process: threading._main_thread=<_MainThread(MainThread, started 140583445075712)>
---
History
Date User Action Args
2020年03月27日 16:29:48vstinnersetrecipients: + vstinner, Batuhan Taskaya
2020年03月27日 16:29:48vstinnersetmessageid: <1585326588.57.0.914054012686.issue40089@roundup.psfhosted.org>
2020年03月27日 16:29:48vstinnerlinkissue40089 messages
2020年03月27日 16:29:48vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /