Author ncoghlan
Recipients BreamoreBoy, eric.araujo, eric.snow, martin.panter, ncoghlan, python-dev, robagar, schlamar
Date 2015-12-06.11:23:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1449400986.62.0.725859773795.issue14285@psf.upfronthosting.co.za>
In-reply-to
Content
Ah, I think I understand the problem you're getting at now:

* if the parent package is missing entirely, we still want to suppress the traceback by throwing the runpy specific exception
* if the parent package is present, but one of the modules *that* tries to import is missing (or otherwise doesn't load), we want to let the traceback happen normally

The exception handler in the new code snippet addresses that by checking the name attribute on the ImportError, but could likely use a comment explaining the subtlety.

The way you've handled checking the result of the rpartition call also highlights a deficiency in the runpy docs, and likely also the test suite as well: runpy.run_module and the -m switch only work with absolute module names, but this isn't stated explicitly in the documentation, nor is there any early check in _get_module_details() to bail out if given a relative module name.
History
Date User Action Args
2015-12-06 11:23:06ncoghlansetrecipients: + ncoghlan, eric.araujo, BreamoreBoy, python-dev, schlamar, eric.snow, martin.panter, robagar
2015-12-06 11:23:06ncoghlansetmessageid: <1449400986.62.0.725859773795.issue14285@psf.upfronthosting.co.za>
2015-12-06 11:23:06ncoghlanlinkissue14285 messages
2015-12-06 11:23:06ncoghlancreate