Skip to content

typing_extensions.TypeForm should re-export typing.TypeForm on python 3.15 #16463

Description

@DetachHead
# some library i use that needs to work on older python versions:
import typing_extensions
def fn[T](typ: typing_extensions.TypeForm[T]): ...


# my project that uses python 3.15
import typing
typ: typing.TypeForm[int | None] = int | None

fn(typ) # error:  "TypeForm[int | None]" is not assignable to "TypeForm[T@fn]"

playground

the fix would be to do this, which is consistent with everything else in typing_extensions.pyi:

if sys.version_info >= (3, 15):
    from typing import TypeForm as TypeForm
else:
    TypeForm: _SpecialForm

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions