github python/typing_extensions 4.12.0a1

latest releases: 4.12.2, 4.12.1, 4.12.0...
pre-release5 months ago

This release primarily tests a revised release workflow. If all goes
well, release 4.12.0rc1 will follow soon.

  • Backport the typing.NoDefault sentinel object from Python 3.13.
    TypeVars, ParamSpecs and TypeVarTuples without default values now have
    their __default__ attribute set to this sentinel value.
  • TypeVars, ParamSpecs and TypeVarTuples now have a has_default()
    method, matching typing.TypeVar, typing.ParamSpec and
    typing.TypeVarTuple on Python 3.13+.
  • TypeVars, ParamSpecs and TypeVarTuples with default=None passed to
    their constructors now have their __default__ attribute set to None
    at runtime rather than types.NoneType.
  • Fix most tests for TypeVar, ParamSpec and TypeVarTuple on Python
    3.13.0b1 and newer.
  • Backport CPython PR #118774,
    allowing type parameters without default values to follow those with
    default values in some type parameter lists. Patch by Alex Waygood,
    backporting a CPython PR by Jelle Zijlstra.
  • It is now disallowed to use a TypeVar with a default value after a
    TypeVarTuple in a type parameter list. This matches the CPython
    implementation of PEP 696 on Python 3.13+.
  • Fix bug in PEP-696 implementation where default values for ParamSpecs
    would be cast to tuples if a list was provided as the default value.
    Patch by Alex Waygood.
  • Fix Protocol tests on Python 3.13.0a6 and newer. 3.13.0a6 adds a new
    __static_attributes__ attribute to all classes in Python,
    which broke some assumptions made by the implementation of
    typing_extensions.Protocol. Similarly, 3.13.0b1 adds the new
    __firstlineno__ attribute to all classes.
  • Fix AttributeError when using typing_extensions.runtime_checkable
    in combination with typing.Protocol on Python 3.12.2 or newer.
    Patch by Alex Waygood.
  • At runtime, assert_never now includes the repr of the argument
    in the AssertionError. Patch by Hashem, backporting of the original
    fix python/cpython#91720 by Jelle Zijlstra.
  • The second and third parameters of typing_extensions.Generator,
    and the second parameter of typing_extensions.AsyncGenerator,
    now default to None. This matches the behaviour of typing.Generator
    and typing.AsyncGenerator on Python 3.13+.
  • typing_extensions.ContextManager and
    typing_extensions.AsyncContextManager now have an optional second
    parameter, which defaults to Optional[bool]. The new parameter
    signifies the return type of the __(a)exit__ method, matching
    typing.ContextManager and typing.AsyncContextManager on Python
    3.13+.
  • Backport types.CapsuleType from Python 3.13.

Don't miss a new typing_extensions release

NewReleases is sending notifications on new releases.