summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-09 15:50:26 (GMT)
committerGitHub <noreply@github.com>2023-07-09 15:50:26 (GMT)
commitee46cb6aa959d891b0a480fea29f1eb991e0fad8 (patch)
tree01f90018669fcdeaf3dc568621a655cf8cc10078 /Objects/weakrefobject.c
parent1e12c8cfa373e57aaec65a574e5e4932bbbc0d4f (diff)
downloadcpython-ee46cb6aa959d891b0a480fea29f1eb991e0fad8.zip
cpython-ee46cb6aa959d891b0a480fea29f1eb991e0fad8.tar.gz
cpython-ee46cb6aa959d891b0a480fea29f1eb991e0fad8.tar.bz2
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>
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index bac3e79..e956372 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -913,7 +913,7 @@ PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
return -1;
}
*pobj = _PyWeakref_GET_REF(ref);
- return 0;
+ return (*pobj != NULL);
}