Skip to content

Commit a9716b7

Browse files
[3.14] gh-80384: Fix docs for PyWeakref_NewRef() and PyWeakref_NewProxy() (GH-151146) (GH-151232)
The type of the callback argument is not checked. (cherry picked from commit 0b6adeb) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent a4bdc21 commit a9716b7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/c-api/weakref.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ as much as it can.
4242
callable object that receives notification when *ob* is garbage collected; it
4343
should accept a single parameter, which will be the weak reference object
4444
itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a
45-
weakly referenceable object, or if *callback* is not callable, ``None``, or
46-
``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
45+
weakly referenceable object, this will raise :exc:`TypeError` and return
46+
``NULL``.
4747
4848
.. seealso::
4949
:c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly
@@ -58,8 +58,8 @@ as much as it can.
5858
be a callable object that receives notification when *ob* is garbage
5959
collected; it should accept a single parameter, which will be the weak
6060
reference object itself. *callback* may also be ``None`` or ``NULL``. If *ob*
61-
is not a weakly referenceable object, or if *callback* is not callable,
62-
``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`.
61+
weakly referenceable object, this will raise :exc:`TypeError` and return
62+
``NULL``.
6363
6464
.. seealso::
6565
:c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly

0 commit comments

Comments
 (0)