summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/tupleobject.c6
-rw-r--r--Objects/unicodeobject.c15
2 files changed, 7 insertions, 14 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 5625a65..c63afcc 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -879,8 +879,7 @@ _PyTuple_Resize(PyObject **pv, Py_ssize_t newsize)
_Py_ForgetReference((PyObject *) v);
/* DECREF items deleted by shrinkage */
for (i = newsize; i < oldsize; i++) {
- Py_XDECREF(v->ob_item[i]);
- v->ob_item[i] = NULL;
+ Py_CLEAR(v->ob_item[i]);
}
sv = PyObject_GC_Resize(PyTupleObject, v, newsize);
if (sv == NULL) {
@@ -926,8 +925,7 @@ PyTuple_Fini(void)
#if PyTuple_MAXSAVESIZE > 0
/* empty tuples are used all over the place and applications may
* rely on the fact that an empty tuple is a singleton. */
- Py_XDECREF(free_list[0]);
- free_list[0] = NULL;
+ Py_CLEAR(free_list[0]);
(void)PyTuple_ClearFreeList();
#endif
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index eae4bc5..994c4f5 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1902,8 +1902,7 @@ _PyUnicode_ClearStaticStrings()
{
_Py_Identifier *tmp, *s = static_strings;
while (s) {
- Py_DECREF(s->object);
- s->object = NULL;
+ Py_CLEAR(s->object);
tmp = s->next;
s->next = NULL;
s = tmp;
@@ -4005,8 +4004,7 @@ make_decode_exception(PyObject **exceptionObject,
return;
onError:
- Py_DECREF(*exceptionObject);
- *exceptionObject = NULL;
+ Py_CLEAR(*exceptionObject);
}
#ifdef HAVE_MBCS
@@ -6366,8 +6364,7 @@ make_encode_exception(PyObject **exceptionObject,
goto onError;
return;
onError:
- Py_DECREF(*exceptionObject);
- *exceptionObject = NULL;
+ Py_CLEAR(*exceptionObject);
}
}
@@ -8410,8 +8407,7 @@ make_translate_exception(PyObject **exceptionObject,
goto onError;
return;
onError:
- Py_DECREF(*exceptionObject);
- *exceptionObject = NULL;
+ Py_CLEAR(*exceptionObject);
}
}
@@ -13502,8 +13498,7 @@ _PyUnicodeWriter_Finish(_PyUnicodeWriter *writer)
PyObject *newbuffer;
newbuffer = resize_compact(writer->buffer, writer->pos);
if (newbuffer == NULL) {
- Py_DECREF(writer->buffer);
- writer->buffer = NULL;
+ Py_CLEAR(writer->buffer);
return NULL;
}
writer->buffer = newbuffer;