Skip to content

3.14 regression: Union[int, str] is Union[int, str] does not hold #131933

Closed
@hroncok

Description

@hroncok

Bug report

Bug description:

Python 3.13.2

>>> from typing import Union
>>> Union[int, str] is Union[int, str]
True

Python 3.14.0a6

>>> from typing import Union
>>> Union[int, str] is Union[int, str]
False

Is this change desired, is it documented? This breaks tests in https://github.com/python-attrs/cattrs/blob/d8f17b7e7e57006171027df4d647a6fe068b623e/tests/test_disambiguators.py#L211

assert fn({"op": 0, "t": "MESSAGE_CREATE"}) is Union[F, G]

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)stdlibPython modules in the Lib dirtopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions