Skip to content

bpo-47220: Document the optional callback parameter of weakref.WeakMethod #25491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 30, 2022
Merged
6 changes: 4 additions & 2 deletions Doc/library/weakref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,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.

.. versionchanged:: 3.8
Expand Down Expand Up @@ -207,7 +207,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).
Expand All @@ -233,6 +233,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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document the optional *callback* parameter of :class:`WeakMethod`. Patch by
Géry Ogam.