Skip to content

Commit 9628136

Browse files
authored
bpo-47220: Document the optional callback parameter of weakref.WeakMethod (GH-25491)
1 parent bf94c65 commit 9628136

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Doc/library/weakref.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ See :ref:`__slots__ documentation <slots>` for details.
143143
``ProxyType`` or ``CallableProxyType``, depending on whether *object* is
144144
callable. Proxy objects are not :term:`hashable` regardless of the referent; this
145145
avoids a number of problems related to their fundamentally mutable nature, and
146-
prevent their use as dictionary keys. *callback* is the same as the parameter
146+
prevents their use as dictionary keys. *callback* is the same as the parameter
147147
of the same name to the :func:`ref` function.
148148

149149
Accessing an attribute of the proxy object after the referent is
@@ -212,7 +212,7 @@ objects.
212212
discarded when no strong reference to it exists any more.
213213

214214

215-
.. class:: WeakMethod(method)
215+
.. class:: WeakMethod(method[, callback])
216216

217217
A custom :class:`ref` subclass which simulates a weak reference to a bound
218218
method (i.e., a method defined on a class and looked up on an instance).
@@ -238,6 +238,8 @@ objects.
238238
>>> r()
239239
>>>
240240

241+
*callback* is the same as the parameter of the same name to the :func:`ref` function.
242+
241243
.. versionadded:: 3.4
242244

243245
.. class:: finalize(obj, func, /, *args, **kwargs)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document the optional *callback* parameter of :class:`WeakMethod`. Patch by
2+
Géry Ogam.

0 commit comments

Comments
 (0)