summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGregory Beauregard <greg@greg.red>2022-01-28 16:58:39 (GMT)
committerGitHub <noreply@github.com>2022-01-28 16:58:39 (GMT)
commit5445e173e76ec792358082caf660fbdc846c64b2 (patch)
tree3def2baf86fec5a64b0f5e234c94da3b2e1afe73 /Lib/typing.py
parent45faf151c693b6f13f78926761caea6df7242024 (diff)
downloadcpython-5445e173e76ec792358082caf660fbdc846c64b2.zip
cpython-5445e173e76ec792358082caf660fbdc846c64b2.tar.gz
cpython-5445e173e76ec792358082caf660fbdc846c64b2.tar.bz2
bpo-46553: allow bare typing.ClassVar annotations (#30983)
These are used in the wild and covered by dataclasses unit tests. Several static type checkers support this pattern.
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index 36b95d7..232aa1a 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -173,7 +173,7 @@ def _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=
if (isinstance(arg, _GenericAlias) and
arg.__origin__ in invalid_generic_forms):
raise TypeError(f"{arg} is not valid as type argument")
- if arg in (Any, NoReturn, Final):
+ if arg in (Any, NoReturn, ClassVar, Final):
return arg
if isinstance(arg, _SpecialForm) or arg in (Generic, Protocol):
raise TypeError(f"Plain {arg} is not valid as type argument")