From d8d94fe18ced5dee9e7bff358629bea22b3b566b Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 6 Apr 2025 13:51:14 +0100 Subject: [PATCH 1/2] gh-132139: 3.14 what's new: elaborate on why you can no longer set `Union` attributes Explain in a bit more detail why we think this is an acceptable change to make without a deprecation period --- Doc/whatsnew/3.14.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index b20d75c1180713..9dea07acdc4a27 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -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`.) From ce622d5d04ce10f4df3f9bfab41fac8fd188f9e2 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 6 Apr 2025 13:56:17 +0100 Subject: [PATCH 2/2] Update Doc/whatsnew/3.14.rst --- Doc/whatsnew/3.14.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index 9dea07acdc4a27..de76e253eb9264 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -1131,7 +1131,7 @@ typing this raised :exc:`TypeError`. - The ``__args__`` attribute of :class:`typing.Union` objects is no longer writable. - 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 + 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`.)