diff options
author | Ivan Levkivskyi <levkivskyi@gmail.com> | 2017-02-24 03:03:28 (GMT) |
---|---|---|
committer | Mariatta <Mariatta@users.noreply.github.com> | 2017-02-24 03:03:28 (GMT) |
commit | abb3b8ad94d699c8560d94ee9bac9c917b382abe (patch) | |
tree | 8032e4fe1bee448b36cfacad7c0f98579a09ca1f /Lib/typing.py | |
parent | 1aceb024172ea3d6f9dd6e90f4fbe63ea1fb054e (diff) | |
download | cpython-abb3b8ad94d699c8560d94ee9bac9c917b382abe.zip cpython-abb3b8ad94d699c8560d94ee9bac9c917b382abe.tar.gz cpython-abb3b8ad94d699c8560d94ee9bac9c917b382abe.tar.bz2 |
Update to typing: treat subscripted generics as proxies (#265)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index efe358f..fc2ed94 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -1158,6 +1158,13 @@ class GenericMeta(TypingMeta, abc.ABCMeta): self.__parameters__, self.__args__, self.__origin__, self.__extra__, self.__orig_bases__) + def __setattr__(self, attr, value): + # We consider all the subscripted genrics as proxies for original class + if attr.startswith('__') and attr.endswith('__'): + super(GenericMeta, self).__setattr__(attr, value) + else: + super(GenericMeta, _gorg(self)).__setattr__(attr, value) + # Prevent checks for Generic to crash when defining Generic. Generic = None |