diff options
author | Brett Cannon <brett@python.org> | 2011-03-23 23:06:00 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2011-03-23 23:06:00 (GMT) |
commit | a7468bc5c6153784fb9ab35baf030162208d852d (patch) | |
tree | a4aca9e4cf68517aa017d2e5dc563841201dc681 | |
parent | f3c524d535965ec964ea497290aebc0d1e10bb66 (diff) | |
download | cpython-a7468bc5c6153784fb9ab35baf030162208d852d.zip cpython-a7468bc5c6153784fb9ab35baf030162208d852d.tar.gz cpython-a7468bc5c6153784fb9ab35baf030162208d852d.tar.bz2 |
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.
-rw-r--r-- | Lib/importlib/_bootstrap.py | 2 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index a944bee..f2ef1cf 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -758,7 +758,7 @@ class _ImportLockContext: _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 @@ -84,6 +84,8 @@ Core and Builtins 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. |