From 128441f190bffc0782a9ae0f2f72515c7c137856 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 13 May 2024 22:30:19 +0300 Subject: [PATCH 1/2] gh-119010: Adds docs about `__type_params__` to `functools.update_wrapper` --- Doc/library/functools.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 1f003b3a94fda2..c138031ddfba7f 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -646,8 +646,9 @@ The :mod:`functools` module defines the following functions: attributes of the wrapper function are updated with the corresponding attributes from the original function. The default values for these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` (which assigns to the wrapper - function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__`` - and ``__doc__``, the documentation string) and ``WRAPPER_UPDATES`` (which + function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__``, + ``__doc__``, and ``__type_params__``, the documentation string) + and ``WRAPPER_UPDATES`` (which updates the wrapper function's ``__dict__``, i.e. the instance dictionary). To allow access to the original function for introspection and other purposes @@ -677,6 +678,9 @@ The :mod:`functools` module defines the following functions: function, even if that function defined a ``__wrapped__`` attribute. (see :issue:`17482`) + .. versionchanged:: 3.12 + The ``__type_params__`` attribute is now copied by default. + .. decorator:: wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES) From 75ff6169ca88d34c2f336e757b4d973443598a03 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Mon, 13 May 2024 22:43:05 +0300 Subject: [PATCH 2/2] Update Doc/library/functools.rst Co-authored-by: Jelle Zijlstra --- Doc/library/functools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index c138031ddfba7f..9d5c72802a21f2 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -647,7 +647,7 @@ The :mod:`functools` module defines the following functions: from the original function. The default values for these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` (which assigns to the wrapper function's ``__module__``, ``__name__``, ``__qualname__``, ``__annotations__``, - ``__doc__``, and ``__type_params__``, the documentation string) + ``__type_params__``, and ``__doc__``, the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's ``__dict__``, i.e. the instance dictionary).