summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-22 02:37:50 (GMT)
committerGitHub <noreply@github.com>2018-11-22 02:37:50 (GMT)
commitb37672daf61740fe1ff9d805f6d74bc5ef04012b (patch)
tree530bb0a89a5de62c1eed68f8b2e616dc24cdc497 /Objects/weakrefobject.c
parent2ff8fb7639a86757c00a7cbbe7da418fffec3870 (diff)
downloadcpython-b37672daf61740fe1ff9d805f6d74bc5ef04012b.zip
cpython-b37672daf61740fe1ff9d805f6d74bc5ef04012b.tar.gz
cpython-b37672daf61740fe1ff9d805f6d74bc5ef04012b.tar.bz2
bpo-35059: Cleanup usage of Python macros (GH-10648)
Don't pass complex expressions but regular variables to Python macros. * _datetimemodule.c: split single large "if" into two "if" in date_new(), time_new() and datetime_new(). * _pickle.c, load_extension(): flatten complex "if" expression into more regular C code. * _ssl.c: addbool() now uses a temporary bool_obj to only evaluate the value once. * weakrefobject.c: replace "Py_INCREF(result = proxy);" with "result = proxy; Py_INCREF(result);"
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 9f492e4..9227aa6 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -833,7 +833,8 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
to avoid violating the invariants of the list
of weakrefs for ob. */
Py_DECREF(result);
- Py_INCREF(result = proxy);
+ result = proxy;
+ Py_INCREF(result);
goto skip_insert;
}
prev = ref;