Commit 65ca88e4 authored by Brett Cannon's avatar Brett Cannon

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.
parent 3ad18dc7
...@@ -22,8 +22,8 @@ def resolve_name(name, package): ...@@ -22,8 +22,8 @@ def resolve_name(name, package):
if not name.startswith('.'): if not name.startswith('.'):
return name return name
elif not package: elif not package:
raise ValueError('{!r} is not a relative name ' raise ValueError(f'no package specified for {repr(name)} '
'(no leading dot)'.format(name)) '(required for relative module names)')
level = 0 level = 0
for character in name: for character in name:
if character != '.': if character != '.':
......
...@@ -109,6 +109,9 @@ Core and Builtins ...@@ -109,6 +109,9 @@ Core and Builtins
Library 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 - Issue #6478: _strptime's regexp cache now is reset after changing timezone
with time.tzset(). with time.tzset().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment