mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Update to typing: treat subscripted generics as proxies (#265)
This commit is contained in:
parent
1aceb02417
commit
abb3b8ad94
2 changed files with 34 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue