[Python-checkins] cpython: Have importlib use the repr of a module name in error messages.
brett.cannon
python-checkins at python.org
Thu Mar 24 00:07:23 CET 2011
http://hg.python.org/cpython/rev/9f9b7b656761
changeset: 68886:9f9b7b656761
user: Brett Cannon <brett at python.org>
date: Wed Mar 23 16:06:00 2011 -0700
summary:
Have importlib use the repr of a module name in error messages.
This makes it obvious that an import failed because of some extraneous
whitespace (e.g., a newline).
This is a partial fix for issue #8754.
files:
Lib/importlib/_bootstrap.py | 2 +-
Misc/NEWS | 2 ++
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -758,7 +758,7 @@
_IMPLICIT_META_PATH = [BuiltinImporter, FrozenImporter, _DefaultPathFinder]
-_ERR_MSG = 'No module named {}'
+_ERR_MSG = 'No module named {!r}'
def _gcd_import(name, package=None, level=0):
"""Import and return the module based on its name, the package the call is
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -84,6 +84,8 @@
Library
-------
+- Issue #8754: Have importlib use the repr of a module name in error messages.
+
- Issue #11591: Prevent "import site" from modifying sys.path when python
was started with -S.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list