summaryrefslogtreecommitdiffstats
path: root/Modules/_io/textio.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-27 10:38:28 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-27 10:38:28 (GMT)
commitbdb908ea5466bfa09869fd2e1e7f3b17fe0fb2ea (patch)
treeab1e4e4a74bd5cb976d2473b5e76e9ba74b94edb /Modules/_io/textio.c
parent40005a7807bf2140d045c2bb8b4ef8af1e4770a0 (diff)
parent4a1e70fc31d224786a32f950edaf73c8ea9c194d (diff)
downloadcpython-bdb908ea5466bfa09869fd2e1e7f3b17fe0fb2ea.zip
cpython-bdb908ea5466bfa09869fd2e1e7f3b17fe0fb2ea.tar.gz
cpython-bdb908ea5466bfa09869fd2e1e7f3b17fe0fb2ea.tar.bz2
Issue #20440: Applied yet one patch for using Py_SETREF.
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r--Modules/_io/textio.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 140da10..8c9732b 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -995,8 +995,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
"Oi", self->decoder, (int)self->readtranslate);
if (incrementalDecoder == NULL)
goto error;
- Py_CLEAR(self->decoder);
- self->decoder = incrementalDecoder;
+ Py_SETREF(self->decoder, incrementalDecoder);
}
}
@@ -1374,8 +1373,7 @@ _io_TextIOWrapper_write_impl(textio *self, PyObject *text)
static void
textiowrapper_set_decoded_chars(textio *self, PyObject *chars)
{
- Py_CLEAR(self->decoded_chars);
- self->decoded_chars = chars;
+ Py_SETREF(self->decoded_chars, chars);
self->decoded_chars_used = 0;
}
@@ -1523,8 +1521,7 @@ textiowrapper_read_chunk(textio *self, Py_ssize_t size_hint)
dec_buffer = NULL; /* Reference lost to PyBytes_Concat */
goto fail;
}
- Py_CLEAR(self->snapshot);
- self->snapshot = Py_BuildValue("NN", dec_flags, next_input);
+ Py_SETREF(self->snapshot, Py_BuildValue("NN", dec_flags, next_input));
}
Py_DECREF(input_chunk);
@@ -1630,8 +1627,7 @@ _io_TextIOWrapper_read_impl(textio *self, Py_ssize_t n)
if (chunks != NULL) {
if (result != NULL && PyList_Append(chunks, result) < 0)
goto fail;
- Py_CLEAR(result);
- result = PyUnicode_Join(_PyIO_empty_str, chunks);
+ Py_SETREF(result, PyUnicode_Join(_PyIO_empty_str, chunks));
if (result == NULL)
goto fail;
Py_CLEAR(chunks);