gh-132139: Document that you can no longer set attributes on unions (#132146)

This commit is contained in:
Jelle Zijlstra 2025-04-06 05:43:09 -07:00 committed by GitHub
parent 0dba59e689
commit dbfc6a417a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1130,6 +1130,8 @@ typing
For example, ``isinstance(int | str, typing.Union)`` will return ``True``; previously For example, ``isinstance(int | str, typing.Union)`` will return ``True``; previously
this raised :exc:`TypeError`. this raised :exc:`TypeError`.
- The ``__args__`` attribute of :class:`typing.Union` objects is no longer writable. - 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.
(Contributed by Jelle Zijlstra in :gh:`105499`.) (Contributed by Jelle Zijlstra in :gh:`105499`.)