classification
Title: Wrong error message during import
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, eric.snow, lev.maximov, ncoghlan, python-dev, serhiy.storchaka
Priority: low Keywords: patch

Created on 2016-04-25 06:09 by lev.maximov, last changed 2016-07-15 17:59 by brett.cannon. This issue is now closed.

Files
File name Uploaded Description Edit
error.diff lev.maximov, 2016-04-25 06:09 review
Messages (7)
msg264157 - (view) Author: Lev Maximov (lev.maximov) * Date: 2016-04-25 06:09
Error message was supposedly copy-pasted without change.
Makes it pretty unintuinive to debug.
Fix attached.
msg264158 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-04-25 06:21
LGTM.

But while we are here, it would be nice to replace type(path) with type(path).__name__ (and the same for type(name)).
msg269452 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-06-28 21:44
Should we use __qualname__ instead of __name__?

And I haven't forgotten about your patch, Lev. I'm just occupied trying to get feature changes into Python 3.6 as that has a sooner deadline than bug fixes.
msg269467 - (view) Author: Lev Maximov (lev.maximov) * Date: 2016-06-29 08:36
Nevermind. It's not urgent but should definitely be fixed some day.
Yes, __qualname__ might be a good idea.
msg269483 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-29 13:18
__qualname__ itself is not much more informative than __name__. You should use it together with __module__ to get the full qualified name. But 1) it is never used in error messages, 2) the code becomes more verbose, 3) the output becomes more verbose, and excessive verbose for builtin types.

__name__ LGTM. It is enough to identify the error.
msg270493 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-07-15 17:59
New changeset 22eaf6158e7b by Brett Cannon in branch '3.5':
Issue #26844: Fix imp.find_module() to have the exception related to
https://hg.python.org/cpython/rev/22eaf6158e7b

New changeset 46da639f7114 by Brett Cannon in branch 'default':
Merge for #26844
https://hg.python.org/cpython/rev/46da639f7114
msg270494 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-07-15 17:59
Thanks for the patch, Lev!
History
Date User Action Args
2016-07-15 17:59:36brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg270494

stage: commit review -> resolved
2016-07-15 17:59:18python-devsetnosy: + python-dev
messages: + msg270493
2016-06-29 13:18:49serhiy.storchakasetmessages: + msg269483
2016-06-29 08:36:16lev.maximovsetmessages: + msg269467
2016-06-28 21:44:35brett.cannonsetmessages: + msg269452
2016-04-25 16:50:49brett.cannonsetassignee: brett.cannon
2016-04-25 06:21:35serhiy.storchakasetversions: - Python 2.7
nosy: + eric.snow, serhiy.storchaka, ncoghlan

messages: + msg264158

stage: patch review -> commit review
2016-04-25 06:15:09SilentGhostsetpriority: normal -> low
nosy: + brett.cannon
stage: patch review

versions: - Python 3.2, Python 3.3, Python 3.4
2016-04-25 06:09:06lev.maximovcreate