GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add `__class_getitem__` support to `memoryview` · Issue #126012 · python/cpython

Add __class_getitem__ support to memoryview #126012

New issue
Copy link
New issue
Copy link
Closed
Closed
Add __class_getitem__ support to memoryview#126012
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-featureA feature request or enhancementA feature request or enhancement

Description

@brianschubert
brianschubert
opened on Oct 26, 2024
Issue body actions

Feature or enhancement

Proposal:

memoryview was made generic in typeshed in python/typeshed#12247. Mypy recently received a report (python/mypy#18053) due to it not being subscriptable at runtime:

>>> memoryview[int]
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    memoryview[int]
    ~~~~~~~~~~^^^^^
TypeError: type 'memoryview' is not subscriptable

It seems that memoryview should be made subscriptable at runtime, like other standard library classes that are generic in typeshed.

Happy to make a PR if there's agreement that this should be added.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

  • gh-126012: Add __class_getitem__ to memoryview #126013
Reacted by Tomas R., Alex Waygood, Nice Zombies, Kirill Podoprigora, Peter Bierma, sobolevn and Furkan Onder

Activity

  1. brianschubert
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Oct 26, 2024
  2. tomasr8
    added
    topic-typing
    on Oct 26, 2024
  3. picnixz
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Oct 26, 2024
  4. sobolevn
    added a commit that references this issue on Oct 27, 2024

    gh-126012: Add `__class_getitem__` to `memoryview` (#126013)

    dc76a4a
  5. picnixz commented on Oct 27, 2024

    @picnixz
    picnixz
    on Oct 27, 2024
    Member
    More actions

    Closing since completed. Thanks for the contribution.

    Reacted by Brian Schubert
  6. picnixz
    closed this as completedon Oct 27, 2024
  7. picnixz
    added a commit that references this issue on Dec 8, 2024

    pythongh-126012: Add `__class_getitem__` to `memoryview` (python#126013)

    59f49cf
  8. ebonnal
    added a commit that references this issue on Jan 12, 2025

    pythongh-126012: Add `__class_getitem__` to `memoryview` (python#126013)

    b4d60e9
  9. serhiy-storchaka
    added this to Struct, memoryview and array issues 🏗️on Jul 13, 2026
  10. github-project-automation
    moved this to Done in Struct, memoryview and array issues 🏗️on Jul 13, 2026
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • Struct, memoryview and array issues 🏗️
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.