diff options
author | Brett Cannon <brett@python.org> | 2015-12-04 23:19:42 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2015-12-04 23:19:42 (GMT) |
commit | 65ca88e4e0b3d26e625d1aecd7c0fe0beb5e3b1d (patch) | |
tree | a1f221e3e01a9b3a3e3d3b4385bc0dca64bec390 /Lib/importlib | |
parent | 3ad18dc7a7a5f0613ad9ce787cd92002a556fe7b (diff) | |
download | cpython-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.py | 4 |
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 != '.': |