[issue19946] Handle a non-importable __main__ in multiprocessing

Richard Oudkerk report at bugs.python.org
Fri Dec 20 01:38:03 CET 2013


Richard Oudkerk added the comment:

On 19/12/2013 10:00 pm, Nick Coghlan wrote:
> I think that needs to be fixed on the multiprocessing side rather than just
> in the tests - we shouldn't create a concrete context for a start method
> that isn't going to work on that platform. Finding that kind of discrepancy
> was part of my rationale for basing the skips on the available contexts
> (although my main motivation was simplicity).
>
> There may also be docs implications in describing which methods are
> supported on different platforms (although I haven't looked at how that is
> currently documented).
>
If by "concrete context" you mean _concrete_contexts['forkserver'], then 
that is supposed to be private.  If you write

     ctx = multiprocessing.get_context('forkserver')

then this will raise ValueError if the forkserver method is not 
available.  You can also use

    'forkserver' in multiprocessing.get_all_start_methods()

to check if it is available.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19946>
_______________________________________


More information about the Python-bugs-list mailing list