summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorIvan Levkivskyi <levkivskyi@gmail.com>2018-01-20 11:23:59 (GMT)
committerGitHub <noreply@github.com>2018-01-20 11:23:59 (GMT)
commitd911e40e788fb679723d78b6ea11cabf46caed5a (patch)
treef9743a329c64febe70f7be0b5d610c2a8ea4412d /Lib/dataclasses.py
parentd57f26c753dce61f72b52b96db3a3253d9f2fc3e (diff)
downloadcpython-d911e40e788fb679723d78b6ea11cabf46caed5a.zip
cpython-d911e40e788fb679723d78b6ea11cabf46caed5a.tar.gz
cpython-d911e40e788fb679723d78b6ea11cabf46caed5a.tar.bz2
bpo-32226: PEP 560: improve typing module (#4906)
This PR re-designs the internal typing API using the new PEP 560 features. However, there are only few minor changes in the public API.
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 db14b0f..7d30da1 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