Skip to content

Commit 8fdebd9

Browse files
committed
Use fail label in weakref ternary wrapper
1 parent 0ddc08d commit 8fdebd9

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

Objects/weakrefobject.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -592,27 +592,26 @@ proxy_unwrap(PyObject *obj)
592592
#define WRAP_TERNARY(method, generic) \
593593
static PyObject * \
594594
method(PyObject *proxy, PyObject *v, PyObject *w) { \
595+
PyObject* res = NULL; \
595596
proxy = proxy_unwrap(proxy); \
596597
if (proxy == NULL) { \
597598
return NULL; \
598599
} \
599600
v = proxy_unwrap(v); \
600601
if (v == NULL) { \
601-
Py_DECREF(proxy); \
602-
return NULL; \
602+
goto fail; \
603603
} \
604604
if (w != NULL) { \
605605
w = proxy_unwrap(w); \
606606
if (w == NULL) { \
607-
Py_DECREF(proxy); \
608-
Py_DECREF(v); \
609-
return NULL; \
607+
goto fail; \
610608
} \
611609
} \
612-
PyObject* res = generic(proxy, v, w); \
613-
Py_DECREF(proxy); \
614-
Py_DECREF(v); \
610+
res = generic(proxy, v, w); \
615611
Py_XDECREF(w); \
612+
fail: \
613+
Py_XDECREF(v); \
614+
Py_XDECREF(proxy); \
616615
return res; \
617616
}
618617

0 commit comments

Comments
 (0)