mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
bpo-39573: Use Py_REFCNT() macro (GH-18388)
Replace direct acccess to PyObject.ob_refcnt with usage of the Py_REFCNT() macro.
This commit is contained in:
parent
446463f8db
commit
a93c51e3a8
9 changed files with 42 additions and 38 deletions
|
@ -649,7 +649,7 @@ functools_reduce(PyObject *self, PyObject *args)
|
|||
for (;;) {
|
||||
PyObject *op2;
|
||||
|
||||
if (args->ob_refcnt > 1) {
|
||||
if (Py_REFCNT(args) > 1) {
|
||||
Py_DECREF(args);
|
||||
if ((args = PyTuple_New(2)) == NULL)
|
||||
goto Fail;
|
||||
|
@ -666,7 +666,7 @@ functools_reduce(PyObject *self, PyObject *args)
|
|||
result = op2;
|
||||
else {
|
||||
/* Update the args tuple in-place */
|
||||
assert(args->ob_refcnt == 1);
|
||||
assert(Py_REFCNT(args) == 1);
|
||||
Py_XSETREF(_PyTuple_ITEMS(args)[0], result);
|
||||
Py_XSETREF(_PyTuple_ITEMS(args)[1], op2);
|
||||
if ((result = PyObject_Call(func, args, NULL)) == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue