Skip to content

no error when subscripting AbstractContextManager when targeting python 3.8 #16097

Closed

Description

@DetachHead
from contextlib import AbstractContextManager

foo = AbstractContextManager[int] # runtime error, no mypy error

playground

Activity

  1. KotlinIsland commented on Sep 13, 2023

    @KotlinIsland
    Contributor
  2. Avasam commented on May 18, 2026

    @Avasam
    SponsorContributor

    mypy 1.17 has dropped support for Python 3.8:

    and mypy 2.0 has dropped support for Python 3.9:

    So this specific case of subscripting contextlib.AbstractContextManager should be valid on all supported Python versions

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

    bugmypy got something wrongtopic-pep-585PEP 585 (builtin generics)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions