summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-12-04 23:19:42 (GMT)
committerBrett Cannon <brett@python.org>2015-12-04 23:19:42 (GMT)
commit65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d (patch)
treea1f221e3e01a9b3a3e3d3b4385bc0dca64bec390 /Lib/importlib
parent3ad18dc7a7a5f0613ad9ce787cd92002a556fe7b (diff)
downloadcpython-65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d.zip
cpython-65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d.tar.gz
cpython-65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d.tar.bz2
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.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/util.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py
index 1dbff26..39cb0f7 100644
--- a/Lib/importlib/util.py
+++ b/Lib/importlib/util.py
@@ -22,8 +22,8 @@ def resolve_name(name, package):
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 != '.':