Skip to content

no error __future__.annotations is imported, targeting python 3.8 and subscripting type in a position where it gets evaluated at runtime #15773

Closed

Activity

  1. KotlinIsland commented on Sep 13, 2023

    @KotlinIsland
    Contributor

    Found some other ones in the wild

    from __future__ import annotations
    
    A = type[int]  # no error
    
    from typing import TypeVar, cast
    T = TypeVar("T", bound=type[int])
    
    cast(list[int], 1)
  2. Avasam commented on May 18, 2026

    @Avasam
    SponsorContributor
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)topic-runtime-semanticsmypy doesn't model runtime semantics correctly

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions