[Python-checkins] bpo-47220: Document the optional callback parameter of weakref.WeakMethod (GH-25491)

miss-islington webhook-mailer at python.org
Wed Nov 30 14:53:10 EST 2022


https://github.com/python/cpython/commit/90701ebaf4b121b9a9767d5e8645b8e9de7702af
commit: 90701ebaf4b121b9a9767d5e8645b8e9de7702af
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-11-30T11:53:04-08:00
summary:

bpo-47220: Document the optional callback parameter of weakref.WeakMethod (GH-25491)

(cherry picked from commit 9628136fac997847b4662e6a17faf06d2a0507eb)

Co-authored-by: Géry Ogam <gery.ogam at gmail.com>

files:
A Misc/NEWS.d/next/Library/2022-04-04-22-54-11.bpo-47220.L9jYu4.rst
M Doc/library/weakref.rst

diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst
index a1e542b1e927..73e7b21ae405 100644
--- a/Doc/library/weakref.rst
+++ b/Doc/library/weakref.rst
@@ -143,7 +143,7 @@ See :ref:`__slots__ documentation <slots>` for details.
    ``ProxyType`` or ``CallableProxyType``, depending on whether *object* is
    callable.  Proxy objects are not :term:`hashable` regardless of the referent; this
    avoids a number of problems related to their fundamentally mutable nature, and
-   prevent their use as dictionary keys.  *callback* is the same as the parameter
+   prevents their use as dictionary keys.  *callback* is the same as the parameter
    of the same name to the :func:`ref` function.
 
    Accessing an attribute of the proxy object after the referent is
@@ -212,7 +212,7 @@ objects.
    discarded when no strong reference to it exists any more.
 
 
-.. class:: WeakMethod(method)
+.. class:: WeakMethod(method[, callback])
 
    A custom :class:`ref` subclass which simulates a weak reference to a bound
    method (i.e., a method defined on a class and looked up on an instance).
@@ -238,6 +238,8 @@ objects.
       >>> r()
       >>>
 
+   *callback* is the same as the parameter of the same name to the :func:`ref` function.
+
    .. versionadded:: 3.4
 
 .. class:: finalize(obj, func, /, *args, **kwargs)
diff --git a/Misc/NEWS.d/next/Library/2022-04-04-22-54-11.bpo-47220.L9jYu4.rst b/Misc/NEWS.d/next/Library/2022-04-04-22-54-11.bpo-47220.L9jYu4.rst
new file mode 100644
index 000000000000..6e2af088640b
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-04-04-22-54-11.bpo-47220.L9jYu4.rst
@@ -0,0 +1,2 @@
+Document the optional *callback* parameter of :class:`WeakMethod`. Patch by
+Géry Ogam.



More information about the Python-checkins mailing list