mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-46644: Remove callable() requirement from typing._type_check (GH-31151)
We also remove all the tests that check for integer literals.
This commit is contained in:
parent
a89c29fbcc
commit
870b22b9c4
4 changed files with 7 additions and 33 deletions
|
@ -185,10 +185,7 @@ def _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=
|
|||
return arg
|
||||
if isinstance(arg, _SpecialForm) or arg in (Generic, Protocol):
|
||||
raise TypeError(f"Plain {arg} is not valid as type argument")
|
||||
if isinstance(arg, (type, TypeVar, ForwardRef, types.UnionType, ParamSpec,
|
||||
ParamSpecArgs, ParamSpecKwargs, TypeVarTuple)):
|
||||
return arg
|
||||
if not callable(arg):
|
||||
if type(arg) is tuple:
|
||||
raise TypeError(f"{msg} Got {arg!r:.100}.")
|
||||
return arg
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue