Skip to content

asyncio Generic classes should return GenericAlias in __class_getitem__ #90627

Closed

Description

@kumaraditya303
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']

    Activity

    1. kumaraditya303 commented on Jan 22, 2022

      @kumaraditya303
      ContributorAuthor

      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__'
    2. asvetlov commented on Jan 22, 2022

      @asvetlov
      Contributor

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

    3. asvetlov commented on Jan 22, 2022

      @asvetlov
      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

    4. miss-islington commented on Jan 22, 2022

      @miss-islington
      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

    5. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifetype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions