]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-80384: Fix docs for PyWeakref_NewRef() and PyWeakref_NewProxy() (GH-151146)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 10 Jun 2026 10:41:19 +0000 (13:41 +0300)
committerGitHub <noreply@github.com>
Wed, 10 Jun 2026 10:41:19 +0000 (13:41 +0300)
The type of the callback argument is not checked.

Doc/c-api/weakref.rst

index db6ae0a9d4ea3d7f967cc772e7fd1875a2c3b024..d0c8d4a847a7c8d0ab6bfd7a489ff03d551ec2e1 100644 (file)
@@ -42,8 +42,8 @@ as much as it can.
    callable object that receives notification when *ob* is garbage collected; it
    should accept a single parameter, which will be the weak reference object
    itself. *callback* may also be ``None`` or ``NULL``.  If *ob* is not a
-   weakly referenceable object, or if *callback* is not callable, ``None``, or
-   ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
+   weakly referenceable object, this will raise :exc:`TypeError` and return
+   ``NULL``.
 
    .. seealso::
       :c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly
@@ -58,8 +58,8 @@ as much as it can.
    be a callable object that receives notification when *ob* is garbage
    collected; it should accept a single parameter, which will be the weak
    reference object itself. *callback* may also be ``None`` or ``NULL``.  If *ob*
-   is not a weakly referenceable object, or if *callback* is not callable,
-   ``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
+   weakly referenceable object, this will raise :exc:`TypeError` and return
+   ``NULL``.
 
    .. seealso::
       :c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly