You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio Generic classes should return GenericAlias in __class_getitem__ #90627
In asyncio, the Generic classes return the class itself in __class_getitem__ instead of GenericAlias, because of this they cannot be introspected as GenericAlias objects.
Running Debug|x64 interpreter...
Python 3.11.0a4+ (main, Jan 22 2022, 10:00:18) [MSC v.1930 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> asyncio.Future
<class '_asyncio.Future'>
>>> asyncio.Future[int]
<class '_asyncio.Future'>
>>> list
<class 'list'>
>>> list[int]
list[int]
>>> list[int].__args__
(<class 'int'>,)
>>> asyncio.Future[int].__args__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object '_asyncio.Future' has no attribute '__args__'
New changeset 90e2998 by Miss Islington (bot) in branch '3.10':
[3.10] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (bpo-30784) 90e2998
Activity
kumaraditya303 commentedon Jan 22, 2022
In asyncio, the Generic classes return the class itself in __class_getitem__ instead of GenericAlias, because of this they cannot be introspected as GenericAlias objects.
asvetlov commentedon Jan 22, 2022
New changeset ea5b968 by Kumar Aditya in branch 'main':
bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)
ea5b968
asvetlov commentedon Jan 22, 2022
New changeset 90e2998 by Miss Islington (bot) in branch '3.10':
[3.10] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (bpo-30784)
90e2998
miss-islington commentedon Jan 22, 2022
New changeset 6ed874f by Kumar Aditya in branch '3.9':
[3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (GH-30785)
6ed874f