summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/_struct.c2
-rw-r--r--Modules/cStringIO.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 6149964..8e5420c 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1471,7 +1471,7 @@ s_init(PyObject *self, PyObject *args, PyObject *kwds)
return -1;
Py_INCREF(o_format);
- Py_XDECREF(soself->s_format);
+ Py_CLEAR(soself->s_format);
soself->s_format = o_format;
ret = prepare_s(soself);
diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c
index 3529047..139a4a8 100644
--- a/Modules/cStringIO.c
+++ b/Modules/cStringIO.c
@@ -575,8 +575,7 @@ newOobject(int size) {
static PyObject *
I_close(Iobject *self, PyObject *unused) {
- Py_XDECREF(self->pbuf);
- self->pbuf = NULL;
+ Py_CLEAR(self->pbuf);
self->buf = NULL;
self->pos = self->string_size = 0;