diff options
author | Brett Cannon <brett@python.org> | 2013-12-13 16:43:10 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-12-13 16:43:10 (GMT) |
commit | ca7ab7c7f10f27d8e3df3281c78180802d767358 (patch) | |
tree | 14e032c9b6677d526be2f3f2375e4a9f02ec7ce3 /Lib/multiprocessing | |
parent | 774b2e0af23757e73e7c223c56841cb031178a8c (diff) | |
download | cpython-ca7ab7c7f10f27d8e3df3281c78180802d767358.zip cpython-ca7ab7c7f10f27d8e3df3281c78180802d767358.tar.gz cpython-ca7ab7c7f10f27d8e3df3281c78180802d767358.tar.bz2 |
Issue #19946: Raise ImportError when the main module cannot be found
by multiprocessing.spawn (before it was raising an AttributeError).
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/spawn.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/multiprocessing/spawn.py b/Lib/multiprocessing/spawn.py index 364b53f..c3adfc1 100644 --- a/Lib/multiprocessing/spawn.py +++ b/Lib/multiprocessing/spawn.py @@ -248,6 +248,8 @@ def import_main_path(main_path): main_module = types.ModuleType(main_name) # XXX Use a target of main_module? spec = importlib.find_spec(main_name, path=dirs) + if spec is None: + raise ImportError(name=main_name) methods = importlib._bootstrap._SpecMethods(spec) methods.init_module_attrs(main_module) main_module.__name__ = '__mp_main__' |