Commit ca7ab7c7 authored by Brett Cannon's avatar Brett Cannon

Issue #19946: Raise ImportError when the main module cannot be found

by multiprocessing.spawn (before it was raising an AttributeError).
parent 774b2e0a
......@@ -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__'
......
......@@ -44,6 +44,9 @@ Core and Builtins
Library
-------
- Issue #19946: multiprocessing.spawn now raises ImportError when the module to
be used as the main module cannot be imported.
- Issue #17919: select.poll.poll() again works with poll.POLLNVAL on AIX.
- Issue #19063: if a Charset's body_encoding was set to None, the email
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment