mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Improper type for __package__ should raise TypeError, not ValueError.
This commit is contained in:
parent
068915cc8b
commit
f500778f65
2 changed files with 2 additions and 2 deletions
|
@ -926,7 +926,7 @@ def _sanity_check(name, package, level):
|
|||
raise ValueError('level must be >= 0')
|
||||
if package:
|
||||
if not isinstance(package, str):
|
||||
raise ValueError("__package__ not set to a string")
|
||||
raise TypeError("__package__ not set to a string")
|
||||
elif package not in sys.modules:
|
||||
msg = ("Parent module {0!r} not loaded, cannot perform relative "
|
||||
"import")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue