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 <rep...@bugs.python.org>
<http://bugs.python.org/issue19771>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to