summaryrefslogtreecommitdiff
path: root/Lib/importlib/util.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-12-04 15:19:42 -0800
committerBrett Cannon <brett@python.org>2015-12-04 15:19:42 -0800
commit65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d (patch)
treea1f221e3e01a9b3a3e3d3b4385bc0dca64bec390 /Lib/importlib/util.py
parent3ad18dc7a7a5f0613ad9ce787cd92002a556fe7b (diff)
downloadcpython-git-65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d.tar.gz
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/util.py')
-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 1dbff2605e..39cb0f74fc 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 != '.':