summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkj <28750310+Fidget-Spinner@users.noreply.github.com>2020-12-19 22:32:06 (GMT)
committerGitHub <noreply@github.com>2020-12-19 22:32:06 (GMT)
commit597ebc8cf604de49eabbc7b83be2debd005d7819 (patch)
tree0c0978cc1d24d30aad39dfc93b4e503e3ce39d97
parent6ad5fd14825fc6039a9684dfdc14f5d12b86e25f (diff)
downloadcpython-597ebc8cf604de49eabbc7b83be2debd005d7819.zip
cpython-597ebc8cf604de49eabbc7b83be2debd005d7819.tar.gz
cpython-597ebc8cf604de49eabbc7b83be2debd005d7819.tar.bz2
[3.9] bpo-42675: Document collections.abc.Callable changes (GH-23839) (#23852)
-rw-r--r--Doc/library/types.rst3
-rw-r--r--Doc/whatsnew/3.9.rst19
2 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/types.rst b/Doc/library/types.rst
index 0fe3822..d83d966 100644
--- a/Doc/library/types.rst
+++ b/Doc/library/types.rst
@@ -260,6 +260,9 @@ Standard names are defined for the following types:
.. versionadded:: 3.9
+ .. versionchanged:: 3.9.2
+ This type can now be subclassed.
+
.. class:: TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index f8f421b..68b1e50 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -1497,3 +1497,22 @@ functions and options conditionally available based on the operating system
version in use at runtime ("weaklinking").
(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)
+
+Notable changes in Python 3.9.2
+===============================
+
+collections.abc
+---------------
+
+:class:`collections.abc.Callable` generic now flattens type parameters, similar
+to what :data:`typing.Callable` currently does. This means that
+``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of
+``(int, str, str)``; previously this was ``([int, str], str)``. To allow this
+change, :class:`types.GenericAlias` can now be subclassed, and a subclass will
+be returned when subscripting the :class:`collections.abc.Callable` type.
+Code which accesses the arguments via :func:`typing.get_args` or ``__args__``
+need to account for this change. A :exc:`DeprecationWarning` may be emitted for
+invalid forms of parameterizing :class:`collections.abc.Callable` which may have
+passed silently in Python 3.9.1. This :exc:`DeprecationWarning` will
+become a :exc:`TypeError` in Python 3.10.
+(Contributed by Ken Jin in :issue:`42195`.)