summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Objects/cellobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Objects/cellobject.c')
-rw-r--r--contrib/tools/python3/Objects/cellobject.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/contrib/tools/python3/Objects/cellobject.c b/contrib/tools/python3/Objects/cellobject.c
index f516707f6f8..b1154e4ca4a 100644
--- a/contrib/tools/python3/Objects/cellobject.c
+++ b/contrib/tools/python3/Objects/cellobject.c
@@ -1,6 +1,8 @@
/* Cell object implementation */
#include "Python.h"
+#include "pycore_cell.h" // PyCell_GetRef()
+#include "pycore_modsupport.h" // _PyArg_NoKeywords()
#include "pycore_object.h"
PyObject *
@@ -55,8 +57,7 @@ PyCell_Get(PyObject *op)
PyErr_BadInternalCall();
return NULL;
}
- PyObject *value = PyCell_GET(op);
- return Py_XNewRef(value);
+ return PyCell_GetRef((PyCellObject *)op);
}
int
@@ -66,9 +67,7 @@ PyCell_Set(PyObject *op, PyObject *value)
PyErr_BadInternalCall();
return -1;
}
- PyObject *old_value = PyCell_GET(op);
- PyCell_SET(op, Py_XNewRef(value));
- Py_XDECREF(old_value);
+ PyCell_SetTakeRef((PyCellObject *)op, Py_XNewRef(value));
return 0;
}