mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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.
This commit is contained in:
parent
d57f26c753
commit
d911e40e78
5 changed files with 771 additions and 1640 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue