mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
gh-105927: PyWeakref_GetRef() returns 1 on success (#106561)
PyWeakref_GetRef() now returns 1 on success, and return 0 if the reference is dead. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
1e12c8cfa3
commit
ee46cb6aa9
3 changed files with 6 additions and 4 deletions
|
|
@ -3376,7 +3376,7 @@ test_weakref_capi(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
|
|||
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue