[Python-checkins] cpython: Issue #25771: Tweak ValueError message when package isn't specified
brett.cannon
python-checkins at python.org
Fri Dec 4 18:20:04 EST 2015
https://hg.python.org/cpython/rev/b3a0765671d6
changeset: 99433:b3a0765671d6
user: Brett Cannon <brett at python.org>
date: Fri Dec 04 15:19:42 2015 -0800
summary:
Issue #25771: Tweak ValueError message when package isn't specified
for importlib.util.resolve_name() but is needed.
Thanks to Martin Panter for the bug report.
files:
Lib/importlib/util.py | 4 ++--
Misc/NEWS | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py
--- a/Lib/importlib/util.py
+++ b/Lib/importlib/util.py
@@ -22,8 +22,8 @@
if not name.startswith('.'):
return name
elif not package:
- raise ValueError('{!r} is not a relative name '
- '(no leading dot)'.format(name))
+ raise ValueError(f'no package specified for {repr(name)} '
+ '(required for relative module names)')
level = 0
for character in name:
if character != '.':
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -109,6 +109,9 @@
Library
-------
+- Issue #25771: Tweak the exception message for importlib.util.resolve_name()
+ when 'package' isn't specified but necessary.
+
- Issue #6478: _strptime's regexp cache now is reset after changing timezone
with time.tzset().
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list