Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
The internal function typing._type_check() is used extensively to check whether a particular value represents a type. Its docstring begins with:
def _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=False): """Check that the argument is a type, and return it (internal helper). In Python 3.11b1 this function no longer errors on various kinds of non-types:
>>>importsys>>>sys.version_infosys.version_info(major=3, minor=11, micro=0, releaselevel='beta', serial=1) >>>importtyping>>>typing._type_check(5, "Expected a type.") # no error!>>>typing.ClassVar[5] typing.ClassVar[5] # no error!By contrast on Python 3.10:
>>>importsys>>>sys.version_infosys.version_info(major=3, minor=10, micro=1, releaselevel='final', serial=0) >>>importtyping>>>typing._type_check(5, "Expected a type.") TypeError: Expecteda type. Got5.>>>typing.ClassVar[5] TypeError: typing.ClassVaracceptsonlysingle type. Got5.Your environment
Regression introduced somewhere between Python 3.10 and Python 3.11b1.
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error