Author martin.panter
Recipients BreamoreBoy, eric.araujo, eric.snow, martin.panter, ncoghlan, python-dev, robagar, schlamar
Date 2015-12-04.02:16:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1449195374.11.0.139344050745.issue14285@psf.upfronthosting.co.za>
In-reply-to
Content
Even with my committed fix, tracebacks triggered by initializing a parent package are still suppressed:

$ ./python -m hello
Traceback (most recent call last):
  File "/media/disk/home/proj/python/cpython/Lib/runpy.py", line 158, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/media/disk/home/proj/python/cpython/Lib/runpy.py", line 116, in _get_module_details
    __import__(mod_name)  # Do not catch exceptions initializing package
  File "/media/disk/home/proj/python/cpython/hello/__init__.py", line 1, in <module>
    import random; random.dsgjdgj
AttributeError: module 'random' has no attribute 'dsgjdgj'
[Exit 1]
$ ./python -m hello.submodule
/media/disk/home/proj/python/cpython/python: Error while finding spec for 'hello.submodule' (<class 'AttributeError'>: module 'random' has no attribute 'dsgjdgj')
[Exit 1]

Fixing this in general might require a loop around the find_spec() call as in init-ancestor.patch. But I’m unsure if it is worth the extra complication.
History
Date User Action Args
2015-12-04 02:16:14martin.pantersetrecipients: + martin.panter, ncoghlan, eric.araujo, BreamoreBoy, python-dev, schlamar, eric.snow, robagar
2015-12-04 02:16:14martin.pantersetmessageid: <1449195374.11.0.139344050745.issue14285@psf.upfronthosting.co.za>
2015-12-04 02:16:14martin.panterlinkissue14285 messages
2015-12-04 02:16:13martin.pantercreate