Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncio Generic classes should return GenericAlias in __class_getitem__ #90627

Closed
kumaraditya303 opened this issue Jan 22, 2022 · 4 comments
Closed
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes type-bug An unexpected behavior, bug, or error

Comments

@kumaraditya303
Copy link
Contributor

BPO 46469
Nosy @asvetlov, @1st1, @miss-islington, @kumaraditya303
PRs
  • bpo-46469: Make asyncio generic classes return GenericAlias #30777
  • [3.10] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) #30784
  • [3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)  #30785
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-01-22.14:10:04.875>
    created_at = <Date 2022-01-22.04:41:15.324>
    labels = ['type-bug', '3.9', '3.10', '3.11']
    title = 'asyncio Generic classes should return GenericAlias in __class_getitem__'
    updated_at = <Date 2022-01-22.14:10:04.874>
    user = 'https://github.com/kumaraditya303'

    bugs.python.org fields:

    activity = <Date 2022-01-22.14:10:04.874>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-22.14:10:04.875>
    closer = 'asvetlov'
    components = []
    creation = <Date 2022-01-22.04:41:15.324>
    creator = 'kumaraditya'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46469
    keywords = ['patch']
    message_count = 4.0
    messages = ['411231', '411249', '411251', '411254']
    nosy_count = 4.0
    nosy_names = ['asvetlov', 'yselivanov', 'miss-islington', 'kumaraditya']
    pr_nums = ['30777', '30784', '30785']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46469'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @kumaraditya303
    Copy link
    Contributor Author

    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__'

    @kumaraditya303 kumaraditya303 added 3.11 only security fixes type-bug An unexpected behavior, bug, or error labels Jan 22, 2022
    @asvetlov
    Copy link
    Contributor

    New changeset ea5b968 by Kumar Aditya in branch 'main':
    bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)
    ea5b968

    @kumaraditya303 kumaraditya303 added 3.9 only security fixes 3.10 only security fixes labels Jan 22, 2022
    @asvetlov
    Copy link
    Contributor

    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
    Copy link
    Contributor

    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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants