]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-80384: Fix docs for PyWeakref_NewRef() and PyWeakref_NewProxy() (GH-151146...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 10 Jun 2026 10:48:23 +0000 (12:48 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jun 2026 10:48:23 +0000 (10:48 +0000)
The type of the callback argument is not checked.
(cherry picked from commit 0b6adeb20f5d7c8b81673d14e0a4db41fd2fca2d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Doc/c-api/weakref.rst

index c769e0810136d7f4c509e839c6e8f12d1ce6fd3d..ae19d5feea1a9914daa19c52cd17b1458baf05f2 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