-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-39244: multiprocessing get all start methods #18529
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
bpo-39244: multiprocessing get all start methods #18529
Conversation
Co-Authored-By: Victor Stinner <[email protected]>
…s://github.com/idomic/cpython into bpo-39244multiprocessing-get_all_start_methods
Lib/multiprocessing/context.py
Outdated
@@ -254,7 +254,7 @@ def get_start_method(self, allow_none=False): | |||
return self._actual_context._name | |||
|
|||
def get_all_start_methods(self): | |||
if sys.platform == 'win32': | |||
if sys.platform == 'win32' or sys.platform == 'darwin': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably, non-spawn start methods still exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! I've added a new switch case to deal only with macos
Not sure this is the correct fix, fork and forkserver still exist on macOS. I would think get_all_start_methods should return ['spawn', 'fork', 'forkserver'] on macOS. |
@@ -256,6 +256,8 @@ def get_start_method(self, allow_none=False): | |||
def get_all_start_methods(self): | |||
if sys.platform == 'win32': | |||
return ['spawn'] | |||
elif sys.platform == 'darwin': | |||
return ['spawn', 'fork', 'forkserver'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is HAVE_SEND_HANDLE guaranteed to be defined on macOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's always set from a certain version (could not find documentation for that), the example of the code that defaults to this case and to 'fork' is in the bugs.python.
Adding @taleinat |
Codecov Report
@@ Coverage Diff @@
## master #18529 +/- ##
===========================================
+ Coverage 82.20% 83.13% +0.93%
===========================================
Files 1958 1571 -387
Lines 589743 414833 -174910
Branches 44457 44460 +3
===========================================
- Hits 484772 344858 -139914
+ Misses 95308 60347 -34961
+ Partials 9663 9628 -35
Continue to review full report at Codecov.
|
This is an old PR, please refer to the clean one: GH-18625 |
bpo-39244: multiprocessing get all start methods
[3.8] bpo-39244: multiprocessing get all start methods (GH-18529)
[3.9] bpo-39244: multiprocessing get all start methods (GH-18529)
https://bugs.python.org/issue39244