@@ -179,6 +179,21 @@ codecs
179179Add a :func: `codecs.unregister ` function to unregister a codec search function.
180180(Contributed by Hai Shi in :issue: `41842 `.)
181181
182+ collections.abc
183+ ---------------
184+
185+ The ``__args__ `` of the :ref: `parameterized generic <types-genericalias >` for
186+ :class: `collections.abc.Callable ` are now consistent with :data: `typing.Callable `.
187+ :class: `collections.abc.Callable ` generic now flattens type parameters, similar
188+ to what :data: `typing.Callable ` currently does. This means that
189+ ``collections.abc.Callable[[int, str], str] `` will have ``__args__ `` of
190+ ``(int, str, str) ``; previously this was ``([int, str], str) ``. To allow this
191+ change, :class: `types.GenericAlias ` can now be subclassed, and a subclass will
192+ be returned when subscripting the :class: `collections.abc.Callable ` type. Note
193+ that a :exc: `TypeError ` may be raised for invalid forms of parameterizing
194+ :class: `collections.abc.Callable ` which may have passed silently in Python 3.9.
195+ (Contributed by Ken Jin in :issue: `42195 `.)
196+
182197contextlib
183198----------
184199
@@ -507,6 +522,15 @@ Changes in the Python API
507522 ignored.
508523 (Contributed by Victor Stinner in :issue: `42639 `.)
509524
525+ * :class: `collections.abc.Callable ` generic now flattens type parameters, similar
526+ to what :data: `typing.Callable ` currently does. This means that
527+ ``collections.abc.Callable[[int, str], str] `` will have ``__args__ `` of
528+ ``(int, str, str) ``; previously this was ``([int, str], str) ``. Code which
529+ accesses the arguments via :func: `typing.get_args ` or ``__args__ `` need to account
530+ for this change. Furthermore, :exc: `TypeError ` may be raised for invalid forms
531+ of parameterizing :class: `collections.abc.Callable ` which may have passed
532+ silently in Python 3.9.
533+ (Contributed by Ken Jin in :issue: `42195 `.)
510534
511535CPython bytecode changes
512536========================
0 commit comments