FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-137065: Unmerge types.UnionType and typing.Union by serhiy-storchaka · Pull Request #137069 · python/cpython · GitHub

/ cpython Public

gh-137065: Unmerge types.UnionType and typing.Union - #137069

Draft
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:typing-union
Draft

gh-137065: Unmerge types.UnionType and typing.Union#137069
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:typing-union

Conversation

serhiy-storchaka commented Jul 24, 2025
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

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.

JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't think anything should be changed here.

bedevere-app Bot commented Jul 25, 2025

Copy link
Copy Markdown

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

Comment thread Doc/whatsnew/3.14.rst
- 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 27, 2026
serhiy-storchaka added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 30, 2026
github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO-NOT-MERGE needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL