@@ -11,20 +11,20 @@ simple reference object, and the second acts as a proxy for the original object
11
11
as much as it can.
12
12
13
13
14
- .. c :function :: int PyWeakref_Check (ob)
14
+ .. c :function :: int PyWeakref_Check (PyObject * ob)
15
15
16
- Return true if *ob* is either a reference or proxy object. This function
16
+ Return non-zero if *ob * is either a reference or proxy object. This function
17
17
always succeeds.
18
18
19
19
20
- .. c:function:: int PyWeakref_CheckRef(ob)
20
+ .. c :function :: int PyWeakref_CheckRef (PyObject * ob)
21
21
22
- Return true if *ob* is a reference object. This function always succeeds.
22
+ Return non-zero if *ob * is a reference object. This function always succeeds.
23
23
24
24
25
- .. c:function:: int PyWeakref_CheckProxy(ob)
25
+ .. c :function :: int PyWeakref_CheckProxy (PyObject * ob)
26
26
27
- Return true if *ob* is a proxy object. This function always succeeds.
27
+ Return non-zero if *ob * is a proxy object. This function always succeeds.
28
28
29
29
30
30
.. c :function :: PyObject* PyWeakref_NewRef (PyObject *ob, PyObject *callback)
@@ -51,10 +51,21 @@ as much as it can.
51
51
``None ``, or ``NULL ``, this will return ``NULL `` and raise :exc: `TypeError `.
52
52
53
53
54
+ .. c :function :: int PyWeakref_GetRef (PyObject *ref, PyObject **pobj)
55
+
56
+ Get a :term: `strong reference ` to the referenced object from a weak
57
+ reference, *ref *, into *\* pobj *.
58
+ Return 0 on success. Raise an exception and return -1 on error.
59
+
60
+ If the referent is no longer live, set *\* pobj * to ``NULL `` and return 0.
61
+
62
+ .. versionadded :: 3.13
63
+
64
+
54
65
.. c :function :: PyObject* PyWeakref_GetObject (PyObject *ref)
55
66
56
- Return the referenced object from a weak reference, * ref *. If the referent is
57
- no longer live, returns :const: ` Py_None `.
67
+ Return a :term: ` borrowed reference ` to the referenced object from a weak
68
+ reference, * ref *. If the referent is no longer live, returns `` Py_None ` `.
58
69
59
70
.. note ::
60
71
@@ -63,11 +74,17 @@ as much as it can.
63
74
except when it cannot be destroyed before the last usage of the borrowed
64
75
reference.
65
76
77
+ .. deprecated-removed :: 3.13 3.15
78
+ Use :c:func: `PyWeakref_GetRef ` instead.
79
+
66
80
67
81
.. c :function :: PyObject* PyWeakref_GET_OBJECT (PyObject *ref)
68
82
69
83
Similar to :c:func: `PyWeakref_GetObject `, but does no error checking.
70
84
85
+ .. deprecated-removed :: 3.13 3.15
86
+ Use :c:func: `PyWeakref_GetRef ` instead.
87
+
71
88
72
89
.. c :function :: void PyObject_ClearWeakRefs (PyObject *object)
73
90
0 commit comments