Improper type for __package__ should raise TypeError, not ValueError.

This commit is contained in:
Brett Cannon 2012-02-23 18:29:12 -05:00
parent 068915cc8b
commit f500778f65
2 changed files with 2 additions and 2 deletions

View file

@ -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")