[New-bugs-announce] [issue19771] runpy should check ImportError.name before wrapping it

Nick Coghlan report at bugs.python.org
Mon Nov 25 13:39:47 CET 2013


New submission from Nick Coghlan:

Issue 19769 shows that if __main__ in a package throws ImportError, runpy will incorrectly report the package as not being directly executable (when it actually claims to be executable, it's just broken)

This can be fixed in 3.3+ by checking for an appropriate value in the name attribute of the caught exception, and only wrapping it if the failed lookup was for the __main__ submodule we're looking for.

The associated test can just use a __main__.py that deliberately raises ImportError.

----------
components: Library (Lib)
keywords: easy
messages: 204334
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: runpy should check ImportError.name before wrapping it
type: behavior
versions: Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list