We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 033be36 commit f8d0fbbCopy full SHA for f8d0fbb
Objects/weakrefobject.c
@@ -557,6 +557,21 @@ _proxy_unwrap(PyObject **op, int *did_incref)
557
return 1;
558
}
559
560
+/* If a parameter is a proxy, check that it is still "live" and wrap it,
561
+ * replacing the original value with the raw object. Raises ReferenceError
562
+ * if the param is a dead proxy.
563
+ */
564
+#define UNWRAP(o) \
565
+ if (PyWeakref_CheckProxy(o)) { \
566
+ o = _PyWeakref_GET_REF(o); \
567
+ if (!proxy_check_ref(o)) { \
568
+ return NULL; \
569
+ } \
570
571
+ else { \
572
+ Py_INCREF(o); \
573
+ }
574
+
575
#define WRAP_UNARY(method, generic) \
576
static PyObject * \
577
method(PyObject *proxy) { \
0 commit comments