Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commented Jul 24, 2025

Partially revert GH-105499.

types.UnionType no longer an alias of typing.Union and no longer subscriptable, but subscribing typing.Union returns an instance of types.UnionType. typing.Union can no longer be used in the isinstance() checks.


📚 Documentation preview 📚: https://cpython-previews--137069.org.readthedocs.build/

Partially revert pythonGH-105499. types.UnionType no longer an alias of typing.Union and no longer subscriptable, but subscribing typing.Union returns an instance of types.UnionType. typing.Union can no longer be used in the isinstance() checks.
Copy link
Member

@JelleZijlstraJelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anything should be changed here.

@bedevere-app
Copy link

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

- Both syntaxes for creating a union now produce the same string representation in
``repr()``. For example, ``repr(Union[int, str])``
is now ``"int | str"`` instead of ``"typing.Union[int, str]"``.
- Unions created using the old syntax are no longer cached. Previously, running
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was removed; the text would seem to still apply under this PR.

@serhiy-storchaka
Copy link
MemberAuthor

I now think that we need a full revert. See #138967.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO-NOT-MERGEneeds backport to 3.14bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@serhiy-storchaka@JelleZijlstra