Issue 15256: Typo in error message (original) (raw)

Created on 2012-07-05 18:57 by Marc.Abramowitz, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_issue_15256.patch Marc.Abramowitz,2012-07-06 18:30 review
python_issue_15256.patch Marc.Abramowitz,2012-07-06 20:33 review
Messages (7)
msg164693 - (view) Author: Marc Abramowitz (Marc.Abramowitz) * Date: 2012-07-05 18:57
From a failing unit test with coverage.py, I noticed what seems to be a slight typo in the error message when a module cannot be imported: diff -r 1186d68715cc Lib/imp.py --- a/Lib/imp.py Wed Jul 04 19:33:45 2012 -0700 +++ b/Lib/imp.py Thu Jul 05 11:50:25 2012 -0700 @@ -230,7 +230,7 @@ continue break # Break out of outer loop when breaking out of inner loop. else: - raise ImportError('No module name {!r}'.format(name), name=name) + raise ImportError('No module named {!r}'.format(name), name=name) encoding = None if mode == 'U': Note the missing "d". This makes it match similar existing error messages: Lib/importlib/_bootstrap.py 1238:_ERR_MSG = 'No module named {!r}' Lib/modulefinder.py 185: self.msgout(4, "raise ImportError: No module named", qname) 186: raise ImportError("No module named " + qname) 198: self.msgout(4, "raise ImportError: No module named", mname) 199: raise ImportError("No module named " + mname) 215: raise ImportError("No module named " + subname) Lib/runpy.py 106: raise ImportError("No module named %s" % mod_name) I wonder if this can be centralized to ensure that all code uses the exact same message?
msg164740 - (view) Author: Marc Abramowitz (Marc.Abramowitz) * Date: 2012-07-06 17:33
I think this is just a simple typo and a consistency issue; not a grammatical issue. The misspelled version was added in a recent commit: [last: 0] marca@SCML-MarcA:~/dev/hg-repos/cpython$ hg log -r 76455 changeset: 76455:085cf1480cfe user: Brett Cannon <brett@python.org> date: Sat Apr 21 21:09:46 2012 -0400 summary: Issue #13959: Re-implement imp.find_module() in Lib/imp.py. Link to issue: http://bugs.python.org/issue13959
msg164744 - (view) Author: Marc Abramowitz (Marc.Abramowitz) * Date: 2012-07-06 18:30
Attaching patch
msg164754 - (view) Author: Marc Abramowitz (Marc.Abramowitz) * Date: 2012-07-06 20:33
Patch with Brett's comments
msg164960 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-07-08 01:44
Patch looks fine. Next time I have python-dev time I will commit it.
msg165097 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-07-09 17:24
New changeset 75831951a6b5 by Brett Cannon in branch 'default': Issue #15256: Re-use the ImportError exception message as defined by http://hg.python.org/cpython/rev/75831951a6b5
msg165098 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-07-09 17:25
Thanks for the patch, Marc!
History
Date User Action Args
2022-04-11 14:57:32 admin set github: 59461
2012-07-09 17:25:04 brett.cannon set status: open -> closedresolution: fixedmessages: +
2012-07-09 17:24:43 python-dev set nosy: + python-devmessages: +
2012-07-08 01:44:53 brett.cannon set assignee: brett.cannonmessages: + stage: patch review -> commit review
2012-07-07 02:32:03 terry.reedy set stage: needs patch -> patch review
2012-07-06 20:33:53 Marc.Abramowitz set files: + python_issue_15256.patchmessages: +
2012-07-06 18:30:09 Marc.Abramowitz set files: + python_issue_15256.patchkeywords: + patchmessages: +
2012-07-06 17:40:35 ezio.melotti set keywords: + easynosy: + ezio.melottistage: needs patch
2012-07-06 17:33:04 Marc.Abramowitz set messages: +
2012-07-06 17:11:25 jcea set nosy: + jcea
2012-07-05 19:00:11 nedbat set nosy: + nedbat
2012-07-05 18:57:48 Marc.Abramowitz create