Message255849
| 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. |
|