[issue14439] Easier error diagnosis when bootstrapping the runpy module in main

Nick Coghlan report at bugs.python.org
Fri Mar 30 03:49:38 CEST 2012


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Taking a closer look at the four affected cases, I've changed my mind - the patch looks reasonable, go ahead and add it (as the new output actually still makes sense in the RunMainFromImporter case)

However, additional test cases should be added to test_cmd_line_script, at least for the two that are fairly easy to test:

- runpy import failure: shadow the stdlib by creating a runpy.py that raises RuntimeError at the top level
- runpy attribute lookup failure: shadow the stdlib with an empty runpy.py

I have no idea how you could force the latter two errors, though, so I'm fine with leaving those paths untested (while tests would be great if you can figure out some way to make the decoding and argument construction steps fail, I expect the use of the surrogateescape error handler will make that very hard to do).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14439>
_______________________________________


More information about the Python-bugs-list mailing list