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

Missing class getitems in standard library classes #83200

Closed
isidentical opened this issue Dec 10, 2019 · 8 comments
Closed

Missing class getitems in standard library classes #83200

isidentical opened this issue Dec 10, 2019 · 8 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@isidentical
Copy link
Sponsor Member

BPO 39019
Nosy @gvanrossum, @brettcannon, @serhiy-storchaka, @ilevkivskyi, @isidentical
PRs
  • bpo-39019: Implement missing __class_getitem__ for subprocess classes #17558
  • bpo-39019: Implement missing __class_getitem__ for SpooledTemporaryFile #17560
  • bpo-39019: Implement missing __class_getitem__ for os.DirEntry #17561
  • bpo-39019: Implement missing __class_getitem__ for http.cookies.Morsel #17563
  • 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 2020-04-07.20:37:14.175>
    created_at = <Date 2019-12-10.17:55:54.056>
    labels = ['library', '3.9']
    title = 'Missing class getitems in standard library classes'
    updated_at = <Date 2020-04-07.20:55:44.241>
    user = 'https://github.com/isidentical'

    bugs.python.org fields:

    activity = <Date 2020-04-07.20:55:44.241>
    actor = 'BTaskaya'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-07.20:37:14.175>
    closer = 'BTaskaya'
    components = ['Library (Lib)']
    creation = <Date 2019-12-10.17:55:54.056>
    creator = 'BTaskaya'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39019
    keywords = ['patch']
    message_count = 8.0
    messages = ['358209', '359043', '359044', '362530', '362533', '365937', '365941', '365942']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'brett.cannon', 'serhiy.storchaka', 'levkivskyi', 'BTaskaya']
    pr_nums = ['17558', '17560', '17561', '17563']
    priority = 'normal'
    resolution = None
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39019'
    versions = ['Python 3.9']

    @isidentical
    Copy link
    Sponsor Member Author

    After working on bpo-38994 and bpo-38978, I decided to write a simple AST analyzer to find class getitem syntax usage in typeshed. It discovered a few classes (I am not sure if there are more). As @brett.cannon suggested in PR 17498 I'll prepare individual pull requests.

    typeshed/stdlib/3/subprocess.pyi:868 => Popen
    typeshed/stdlib/3/subprocess.pyi:82 => CompletedProcess
    typeshed/stdlib/3/tempfile.pyi:98 => SpooledTemporaryFile
    typeshed/stdlib/3/os/init.pyi:463 => DirEntry
    typeshed/stdlib/3/http/cookies.pyi:5 => Morsel

    @isidentical isidentical added stdlib Python modules in the Lib dir 3.9 only security fixes labels Dec 10, 2019
    @ilevkivskyi
    Copy link
    Member

    New changeset 4dc5a9d by Ivan Levkivskyi (Batuhan Taşkaya) in branch 'master':
    bpo-39019: Implement missing __class_getitem__ for subprocess classes (GH-17558)
    4dc5a9d

    @ilevkivskyi
    Copy link
    Member

    New changeset 09c482f by Ivan Levkivskyi (Batuhan Taşkaya) in branch 'master':
    bpo-39019: Implement missing __class_getitem__ for SpooledTemporaryFile (GH-17560)
    09c482f

    @gvanrossum
    Copy link
    Member

    Once PEP-585 is implemented these should be rolled back and replaced with that, right?

    @ilevkivskyi
    Copy link
    Member

    Once PEP-585 is implemented these should be rolled back and replaced with that, right?

    I would say that ideally yes.

    @isidentical
    Copy link
    Sponsor Member Author

    PEP-585 is landed, closing the issue (and linked PRs)

    @gvanrossum
    Copy link
    Member

    Hold on, os.DirEntry[str] still doesn't work.

    @isidentical
    Copy link
    Sponsor Member Author

    Hold on, os.DirEntry[str] still doesn't work.

    That is what I asked on the bpo-39481. I couldn't find anything about its cover on PEP-585.

    @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 stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants