summaryrefslogtreecommitdiffstats
path: root/Doc/includes/custom2.c
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/includes/custom2.c')
-rw-r--r--Doc/includes/custom2.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Doc/includes/custom2.c b/Doc/includes/custom2.c
index 6638b9f..a3b2d6a 100644
--- a/Doc/includes/custom2.c
+++ b/Doc/includes/custom2.c
@@ -42,7 +42,7 @@ static int
Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"first", "last", "number", NULL};
- PyObject *first = NULL, *last = NULL, *tmp;
+ PyObject *first = NULL, *last = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist,
&first, &last,
@@ -50,14 +50,10 @@ Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)
return -1;
if (first) {
- tmp = self->first;
- self->first = Py_NewRef(first);
- Py_XDECREF(tmp);
+ Py_XSETREF(self->first, Py_NewRef(first));
}
if (last) {
- tmp = self->last;
- self->last = Py_NewRef(last);
- Py_XDECREF(tmp);
+ Py_XSETREF(self->last, Py_NewRef(last));
}
return 0;
}