Get a :term:`strong reference` to the referenced object from a weak
reference, *ref*, into *\*pobj*.
- Return 0 on success. Raise an exception and return -1 on error.
- If the referent is no longer live, set *\*pobj* to ``NULL`` and return 0.
+ * On success, set *\*pobj* to a new :term:`strong reference` to the
+ referenced object and return 1.
+ * If the reference is dead, set *\*pobj* to ``NULL`` and return 0.
+ * On error, raise an exception and return -1.
.. versionadded:: 3.13
// test PyWeakref_GetRef(), reference is alive
PyObject *ref = Py_True; // marker to check that value was set
- assert(PyWeakref_GetRef(weakref, &ref) == 0);
+ assert(PyWeakref_GetRef(weakref, &ref) == 1);
assert(ref == obj);
assert(Py_REFCNT(obj) == (refcnt + 1));
Py_DECREF(ref);