Message255849
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. |
|
Date |
User |
Action |
Args |
2015-12-04 02:16:14 | martin.panter | set | recipients:
+ martin.panter, ncoghlan, eric.araujo, BreamoreBoy, python-dev, schlamar, eric.snow, robagar |
2015-12-04 02:16:14 | martin.panter | set | messageid: <1449195374.11.0.139344050745.issue14285@psf.upfronthosting.co.za> |
2015-12-04 02:16:14 | martin.panter | link | issue14285 messages |
2015-12-04 02:16:13 | martin.panter | create | |
|