Skip to content

gh-132139: 3.14 what's new: elaborate on why you can no longer set Union attributes #132157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1130,8 +1130,9 @@ typing
For example, ``isinstance(int | str, typing.Union)`` will return ``True``; previously
this raised :exc:`TypeError`.
- The ``__args__`` attribute of :class:`typing.Union` objects is no longer writable.
- It is no longer possible to set arbitrary dunder attributes on :class:`typing.Union`
objects.
- It is no longer possible to set any attributes on :class:`typing.Union` objects.
This only ever worked for dunder attributes on previous versions, was never
documented to work, and was subtly broken in many cases.

(Contributed by Jelle Zijlstra in :gh:`105499`.)

Expand Down
Loading