diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-12-12 07:16:33 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-12-12 07:16:33 +0000 |
commit | 33d8a1b42610c88f94c2df8fd1a32d4877581e7e (patch) | |
tree | a423e8d884e24a3c327e74e3033f408d840f0053 /Lib/runpy.py | |
parent | ad587f96a3c42ec8e50142d63fae75a7a9bcebe1 (diff) | |
parent | dda584340e88004b534de6c24a39633bdfdf0104 (diff) | |
download | cpython-git-33d8a1b42610c88f94c2df8fd1a32d4877581e7e.tar.gz |
Issue #19771: Merge runpy error adjustment from 3.5
Diffstat (limited to 'Lib/runpy.py')
-rw-r--r-- | Lib/runpy.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/runpy.py b/Lib/runpy.py index c98af19af4..af6205db49 100644 --- a/Lib/runpy.py +++ b/Lib/runpy.py @@ -132,6 +132,8 @@ def _get_module_details(mod_name, error=ImportError): pkg_main_name = mod_name + ".__main__" return _get_module_details(pkg_main_name, error) except error as e: + if mod_name not in sys.modules: + raise # No module loaded; being a package is irrelevant raise error(("%s; %r is a package and cannot " + "be directly executed") %(e, mod_name)) loader = spec.loader |