• Martin Panter's avatar
    Issue #14285: Do not catch __init__.py exceptions in runpy · 657257ed
    Martin Panter authored
    Initialize package before calling find_spec() for __main__, so that we do not
    incorrectly handle exceptions from __init__.py. When runpy is used from the
    Python CLI, use an internal exception rather than ImportError, to avoid
    catching unexpected exceptions.
    
    Also remove exception message rewriting in _run_module_as_main(), because it
    seems to be redundant with the _get_main_module_details() function.
    657257ed
test_cmd_line_script.py 22.7 KB