diff options
author | Victor Stinner <vstinner@python.org> | 2022-11-22 12:04:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 12:04:19 (GMT) |
commit | 20d9749a0f9b9fa6946019f04a54b6287d16588e (patch) | |
tree | f1e586c82467e7a7dd7e94e24f694f5800c66229 /Modules/_testcapi | |
parent | 1acdfec359fdf3db936168480be0f4157273c200 (diff) | |
download | cpython-20d9749a0f9b9fa6946019f04a54b6287d16588e.zip cpython-20d9749a0f9b9fa6946019f04a54b6287d16588e.tar.gz cpython-20d9749a0f9b9fa6946019f04a54b6287d16588e.tar.bz2 |
gh-99537: Use Py_SETREF() function in longobject C code (#99655)
Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
in longobject.c and _testcapi/long.c.
Diffstat (limited to 'Modules/_testcapi')
-rw-r--r-- | Modules/_testcapi/long.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/_testcapi/long.c b/Modules/_testcapi/long.c index 70e315c..1be8de5 100644 --- a/Modules/_testcapi/long.c +++ b/Modules/_testcapi/long.c @@ -121,8 +121,7 @@ test_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) } temp = PyNumber_Add(num, one); Py_DECREF(one); - Py_DECREF(num); - num = temp; + Py_SETREF(num, temp); if (num == NULL) return NULL; overflow = 0; @@ -165,8 +164,7 @@ test_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) } temp = PyNumber_Subtract(num, one); Py_DECREF(one); - Py_DECREF(num); - num = temp; + Py_SETREF(num, temp); if (num == NULL) return NULL; overflow = 0; @@ -285,8 +283,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) } temp = PyNumber_Add(num, one); Py_DECREF(one); - Py_DECREF(num); - num = temp; + Py_SETREF(num, temp); if (num == NULL) return NULL; overflow = 0; @@ -329,8 +326,7 @@ test_long_long_and_overflow(PyObject *self, PyObject *Py_UNUSED(ignored)) } temp = PyNumber_Subtract(num, one); Py_DECREF(one); - Py_DECREF(num); - num = temp; + Py_SETREF(num, temp); if (num == NULL) return NULL; overflow = 0; |