summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/weakrefobject.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 9e3da1c..0ee64ed 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -932,6 +932,19 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
return (PyObject *)get_or_create_weakref(type, ob, callback);
}
+int
+PyWeakref_IsDead(PyObject *ref)
+{
+ if (ref == NULL) {
+ PyErr_BadInternalCall();
+ return -1;
+ }
+ if (!PyWeakref_Check(ref)) {
+ PyErr_Format(PyExc_TypeError, "expected a weakref, got %T", ref);
+ return -1;
+ }
+ return _PyWeakref_IS_DEAD(ref);
+}
int
PyWeakref_GetRef(PyObject *ref, PyObject **pobj)