mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
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.
This commit is contained in:
parent
3ad18dc7a7
commit
65ca88e4e0
2 changed files with 5 additions and 2 deletions
|
@ -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 != '.':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue