summaryrefslogtreecommitdiff
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index db14b0f66c..7d30da1aac 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -389,7 +389,8 @@ def _get_field(cls, a_name, a_type):
if typing is not None:
# This test uses a typing internal class, but it's the best
# way to test if this is a ClassVar.
- if type(a_type) is typing._ClassVar:
+ if (type(a_type) is typing._GenericAlias and
+ a_type.__origin__ is typing.ClassVar):
# This field is a ClassVar, so it's not a field.
f._field_type = _FIELD_CLASSVAR