[issue19771] runpy should check ImportError.name before wrapping it

2015-12-18 Thread SilentGhost
SilentGhost added the comment: Martin, could you please escape * in Misc/NEWS, it causes a warning when building documentation. -- nosy: +SilentGhost ___ Python tracker

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-18 Thread Martin Panter
Martin Panter added the comment: I think Serhiy just fixed this in revision ed2420379b8d, so it should be okay now. -- ___ Python tracker ___

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 850cc65ceda4 by Martin Panter in branch '3.5': Issue #19771: Omit irrelevant message if package could not be initialized https://hg.python.org/cpython/rev/850cc65ceda4 New changeset 323c10701e5d by Martin Panter in branch 'default': Issue #19771:

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-11 Thread Martin Panter
Changes by Martin Panter : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-11 Thread Berker Peksag
Changes by Berker Peksag : -- stage: patch review -> commit review ___ Python tracker ___

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-10 Thread Nick Coghlan
Nick Coghlan added the comment: The bad-pyc patch looks good to me. -- ___ Python tracker ___ ___

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-10 Thread Martin Panter
Martin Panter added the comment: BTW I already applied the type(ex).__name__ fix in revision 3202d143a194. New error message with this patch: $ ./python -bWall -m bad_pyc [. . .]/python: Error while finding spec for 'bad_pyc.__main__' (ImportError: bad magic number in 'bad_pyc': b'')

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-10 Thread Martin Panter
Martin Panter added the comment: I think I have fixed the original problem via Issue 14285 (fully in 3.5+, partly in 2.7). It involved a bit more than checking ImportError.name, because runpy catches other exceptions like AttributeError, which do not identify a module name. That leaves

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-10 Thread Martin Panter
Martin Panter added the comment: Actually I forgot, this isn’t applicable to Python 2; see . -- versions: -Python 2.7 ___ Python tracker

[issue19771] runpy should check ImportError.name before wrapping it

2015-12-01 Thread Martin Panter
Martin Panter added the comment: My new patch for Issue 14285 should avoid the main problem. However there would still be at least one leftover minor fix worth appyling: fix the exception message to use type(ex).__name__, not repr(type(ex)). -- dependencies: +Traceback wrong on

[issue19771] runpy should check ImportError.name before wrapping it

2015-08-07 Thread Laura Creighton
Laura Creighton added the comment: I tried to run some tests from the python3.4 test suite and got: python3 -m test -ugui test_tk test_ttk_guionly test_idle /usr/bin/python3: Error while finding spec for 'test.__main__' (class 'ImportError': bad magic number in 'test': b'\x03\xf3\r\n'); 'test'

[issue19771] runpy should check ImportError.name before wrapping it

2015-03-11 Thread Martin Panter
Martin Panter added the comment: Posting a new patch with the following changes: * Added Poleto’s original tests, updated according to review comments. Combined the flag and source code string parameters. * Used a different approach to guessing where the offending ImportError came from. Now

[issue19771] runpy should check ImportError.name before wrapping it

2015-03-10 Thread Martin Panter
Martin Panter added the comment: Closely related: Issue 14285, where an ImportError and various other exceptions caused by code in __init__.py are also incorrectly caught, trigger unexpected error messages, with no traceback being reported. Not sure if checking the “name” attribute will help

[issue19771] runpy should check ImportError.name before wrapping it

2015-03-04 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +berker.peksag stage: needs patch - patch review versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19771

[issue19771] runpy should check ImportError.name before wrapping it

2014-04-21 Thread R. David Murray
R. David Murray added the comment: Hmm. It seems to me that .name not being set is a bug in importlib. It appears that importlib doesn't set it in the 'from x import y' case. After a bit of experimenting at the python prompt, I'm not even sure what that code in runpy is *doing*

[issue19771] runpy should check ImportError.name before wrapping it

2014-04-21 Thread Luiz Poleto
Changes by Luiz Poleto luiz.pol...@gmail.com: Added file: http://bugs.python.org/file34995/issue_19771.patch.v2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19771 ___

[issue19771] runpy should check ImportError.name before wrapping it

2014-04-20 Thread Luiz Poleto
Luiz Poleto added the comment: The attached patch provide test cases to validate this error. As noted by R. David Murray in a discussion in the Core-Mentorship list, this error in fact happens then __init__.py throws an ImportError. -- keywords: +patch nosy: +poleto Added file:

[issue19771] runpy should check ImportError.name before wrapping it

2014-04-20 Thread Luiz Poleto
Luiz Poleto added the comment: As suggested by Nick, the fix is done be verifying the name attribute of the raised ImportError exception; the exception is then re-raised with the appropriate description. -- Added file: http://bugs.python.org/file34989/issue_19771.patch

[issue19771] runpy should check ImportError.name before wrapping it

2014-04-18 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19771 ___ ___ Python-bugs-list

[issue19771] runpy should check ImportError.name before wrapping it

2013-12-29 Thread Anthony Kong
Changes by Anthony Kong anthony.hw.k...@gmail.com: -- nosy: +Anthony.Kong ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19771 ___ ___

[issue19771] runpy should check ImportError.name before wrapping it

2013-12-08 Thread Fotis Koutoulakis
Fotis Koutoulakis added the comment: Hello, I'm in the process of trying to find a solution to this problem, but I'm afraid the choice of wording at some point is kind of...ambiguous. I have some questions I want to ask, to clear some doubts in my head: First one is: if __main__ in a

[issue19771] runpy should check ImportError.name before wrapping it

2013-12-08 Thread Nick Coghlan
Nick Coghlan added the comment: By providing a __main__.py submodule, a package is saying I am directly executable. When runpy says it isn't (because running that file happened to raise ImportError), then runpy is wrong. runpy can't make the file work (it's genuinely broken), but it can avoid

[issue19771] runpy should check ImportError.name before wrapping it

2013-11-25 Thread Nick Coghlan
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