classification
Title: Use the repr of a module name for ImportError in ceval.c
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: Arfrever, brett.cannon, eric.snow, haypo, kurazu, python-dev
Priority: normal Keywords: easy, patch

Created on 2013-07-01 16:33 by brett.cannon, last changed 2013-07-12 15:23 by brett.cannon. This issue is now closed.

Files
File name Uploaded Description Edit
bug18342.patch kurazu, 2013-07-06 09:58 review
bug18342_2.patch kurazu, 2013-07-06 10:20 review
bug18342_3.patch kurazu, 2013-07-06 12:04 review
bug18342_4.patch kurazu, 2013-07-07 11:16 review
Messages (10)
msg192138 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-07-01 16:33
>>> from re import bogus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: cannot import name bogus

Should have 'bogus' using the repr to match the other cases of ModuleNotFoundError
msg192397 - (view) Author: Tomasz Maćkowiak (kurazu) * Date: 2013-07-06 09:58
Attaching a test case and a patch for formatting the module name with PyObject_Repr() not PyObject_Str().
msg192403 - (view) Author: Tomasz Maćkowiak (kurazu) * Date: 2013-07-06 10:20
Attaching a modified patch with assertRaisesRegexp used.
msg192419 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-07-06 11:50
The patch looks good to me. Just a minor nit: you should add ^ to the
beginning of the regex.

2013/7/6 Tomasz Maćkowiak <report@bugs.python.org>:
>
> Tomasz Maćkowiak added the comment:
>
> Attaching a modified patch with assertRaisesRegexp used.
>
> ----------
> Added file: http://bugs.python.org/file30796/bug18342_2.patch
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue18342>
> _______________________________________
msg192421 - (view) Author: Tomasz Maćkowiak (kurazu) * Date: 2013-07-06 12:04
Attached a corrected patch with regexps modified.
msg192475 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-07-06 17:36
Tomasz, can you sign the contributor agreement (http://python.org/psf/contrib/contrib-form/) so we can commit your code?
msg192485 - (view) Author: Tomasz Maćkowiak (kurazu) * Date: 2013-07-06 20:17
Signed.
msg192540 - (view) Author: Tomasz Maćkowiak (kurazu) * Date: 2013-07-07 11:16
Attached patch with renamed test methods (as per Brett's review).
msg192946 - (view) Author: Roundup Robot (python-dev) Date: 2013-07-12 15:22
New changeset c3f9292c8efe by Brett Cannon in branch 'default':
Issue #18342: Use the repr of a module name for ``from ... import
http://hg.python.org/cpython/rev/c3f9292c8efe
msg192947 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-07-12 15:23
Patch is in (only moved the tests to a different class) and added Tomasz to the ACKS file.

Thanks for the patch!
History
Date User Action Args
2013-07-12 15:23:24brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg192947

stage: needs patch -> resolved
2013-07-12 15:22:36python-devsetnosy: + python-dev
messages: + msg192946
2013-07-12 14:51:37brett.cannonsettitle: Use the repr of a module name for ModuleNotFoundError in ceval.c -> Use the repr of a module name for ImportError in ceval.c
2013-07-07 11:16:07kurazusetfiles: + bug18342_4.patch

messages: + msg192540
2013-07-06 20:17:03kurazusetmessages: + msg192485
2013-07-06 17:36:31brett.cannonsetmessages: + msg192475
2013-07-06 12:04:08kurazusetfiles: + bug18342_3.patch

messages: + msg192421
2013-07-06 11:50:55hayposetmessages: + msg192419
2013-07-06 10:20:34kurazusetfiles: + bug18342_2.patch

messages: + msg192403
2013-07-06 09:58:32kurazusetfiles: + bug18342.patch

nosy: + kurazu
messages: + msg192397

keywords: + patch
2013-07-03 23:08:38eric.snowsetnosy: + eric.snow
2013-07-01 23:58:04hayposetnosy: + haypo
2013-07-01 18:17:55Arfreversetnosy: + Arfrever
2013-07-01 16:33:50brett.cannoncreate