cpython: e6502bf289ab (original) (raw)
Mercurial > cpython
changeset 99686:e6502bf289ab 2.7
Issue #20440: Applied yet one patch for using Py_SETREF. The patch is automatically generated, it replaces the code that uses Py_CLEAR. [#20440]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Sun, 27 Dec 2015 12:38:48 +0200 |
parents | 512a628c683e |
children | 11670e4be1a9 |
files | Modules/_io/bufferedio.c Modules/_io/textio.c Modules/_struct.c Objects/exceptions.c |
diffstat | 4 files changed, 33 insertions(+), 57 deletions(-)[+] [-] Modules/_io/bufferedio.c 12 Modules/_io/textio.c 15 Modules/_struct.c 6 Objects/exceptions.c 57 |
line wrap: on
line diff
--- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -1028,8 +1028,7 @@ found: Py_CLEAR(res); goto end; }
end: LEAVE_BUFFERED(self) @@ -1264,9 +1263,8 @@ bufferedreader_init(buffered *self, PyOb if (_PyIOBase_check_readable(raw, Py_True) == NULL) return -1;
- Py_SETREF(self->raw, raw); self->buffer_size = buffer_size; self->readable = 1; self->writable = 0; @@ -1687,9 +1685,8 @@ bufferedwriter_init(buffered *self, PyOb if (_PyIOBase_check_writable(raw, Py_True) == NULL) return -1;
- Py_SETREF(self->raw, raw); self->readable = 0; self->writable = 1; @@ -2344,9 +2341,8 @@ bufferedrandom_init(buffered *self, PyOb if (_PyIOBase_check_writable(raw, Py_True) == NULL) return -1;
--- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -966,8 +966,7 @@ textiowrapper_init(textio *self, PyObjec "Oi", self->decoder, (int)self->readtranslate); if (incrementalDecoder == NULL) goto error;
Py_CLEAR(self->decoder);[](#l2.7)
self->decoder = incrementalDecoder;[](#l2.8)
} @@ -1347,8 +1346,7 @@ textiowrapper_write(textio *self, PyObje static void textiowrapper_set_decoded_chars(textio *self, PyObject *chars) {Py_SETREF(self->decoder, incrementalDecoder);[](#l2.9) }[](#l2.10)
@@ -1477,8 +1475,7 @@ textiowrapper_read_chunk(textio *self) goto fail; } Py_DECREF(dec_buffer);
Py_CLEAR(self->snapshot);[](#l2.27)
self->snapshot = Py_BuildValue("NN", dec_flags, next_input);[](#l2.28)
} Py_DECREF(input_chunk); @@ -1578,8 +1575,7 @@ textiowrapper_read(textio *self, PyObjec if (chunks != NULL) { if (result != NULL && PyList_Append(chunks, result) < 0) goto fail;Py_SETREF(self->snapshot, Py_BuildValue("NN", dec_flags, next_input));[](#l2.29)
Py_CLEAR(result);[](#l2.37)
result = PyUnicode_Join(_PyIO_empty_str, chunks);[](#l2.38)
Py_SETREF(result, PyUnicode_Join(_PyIO_empty_str, chunks));[](#l2.39) if (result == NULL)[](#l2.40) goto fail;[](#l2.41) Py_CLEAR(chunks);[](#l2.42)
@@ -1836,8 +1832,7 @@ static PyObject * if (chunks != NULL) { if (line != NULL && PyList_Append(chunks, line) < 0) goto error;
Py_CLEAR(line);[](#l2.47)
line = PyUnicode_Join(_PyIO_empty_str, chunks);[](#l2.48)
Py_SETREF(line, PyUnicode_Join(_PyIO_empty_str, chunks));[](#l2.49) if (line == NULL)[](#l2.50) goto error;[](#l2.51) Py_DECREF(chunks);[](#l2.52)
--- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -1377,15 +1377,13 @@ s_init(PyObject *self, PyObject *args, P if (PyString_Check(o_format)) { Py_INCREF(o_format);
Py_CLEAR(soself->s_format);[](#l3.7)
soself->s_format = o_format;[](#l3.8)
} else if (PyUnicode_Check(o_format)) { PyObject *str = PyUnicode_AsEncodedString(o_format, "ascii", NULL); if (str == NULL) return -1;Py_SETREF(soself->s_format, o_format);[](#l3.9)
Py_CLEAR(soself->s_format);[](#l3.15)
soself->s_format = str;[](#l3.16)
--- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -62,9 +62,8 @@ BaseException_init(PyBaseExceptionObject Py_SETREF(self->args, args); if (PyTuple_GET_SIZE(self->args) == 1) {
Py_CLEAR(self->message);[](#l4.7)
self->message = PyTuple_GET_ITEM(self->args, 0);[](#l4.8)
Py_INCREF(self->message);[](#l4.9)
Py_INCREF(PyTuple_GET_ITEM(self->args, 0));[](#l4.10)
} return 0; } @@ -279,9 +278,8 @@ BaseException_set_dict(PyBaseExceptionOb PyErr_SetString(PyExc_TypeError, "dict must be a dictionary"); return -1; }Py_SETREF(self->message, PyTuple_GET_ITEM(self->args, 0));[](#l4.11)
@@ -307,8 +305,7 @@ BaseException_set_args(PyBaseExceptionOb seq = PySequence_Tuple(val); if (!seq) return -1;
@@ -608,19 +605,16 @@ EnvironmentError_init(PyEnvironmentError &myerrno, &strerror, &filename)) { return -1; }
/* self->filename will remain Py_None otherwise */ if (filename != NULL) {
Py_CLEAR(self->filename); /* replacing */[](#l4.54)
self->filename = filename;[](#l4.55)
Py_INCREF(self->filename);[](#l4.56)
Py_INCREF(filename);[](#l4.57)
Py_SETREF(self->filename, filename);[](#l4.58)
subslice = PyTuple_GetSlice(args, 0, 2); if (!subslice) @@ -877,8 +871,7 @@ WindowsError_init(PyWindowsErrorObject * return -1; posix_errno = winerror_to_errno(errcode);
o_errcode = PyInt_FromLong(posix_errno); if (!o_errcode) @@ -1063,9 +1056,8 @@ SyntaxError_init(PySyntaxErrorObject *se return -1; if (lenargs >= 1) {
Py_CLEAR(self->msg);[](#l4.76)
self->msg = PyTuple_GET_ITEM(args, 0);[](#l4.77)
Py_INCREF(self->msg);[](#l4.78)
Py_INCREF(PyTuple_GET_ITEM(args, 0));[](#l4.79)
} if (lenargs == 2) { info = PyTuple_GET_ITEM(args, 1);Py_SETREF(self->msg, PyTuple_GET_ITEM(args, 0));[](#l4.80)
@@ -1080,21 +1072,17 @@ SyntaxError_init(PySyntaxErrorObject *se return -1; }
Py_CLEAR(self->filename);[](#l4.88)
self->filename = PyTuple_GET_ITEM(info, 0);[](#l4.89)
Py_INCREF(self->filename);[](#l4.90)
Py_INCREF(PyTuple_GET_ITEM(info, 0));[](#l4.91)
Py_SETREF(self->filename, PyTuple_GET_ITEM(info, 0));[](#l4.92)
Py_CLEAR(self->lineno);[](#l4.94)
self->lineno = PyTuple_GET_ITEM(info, 1);[](#l4.95)
Py_INCREF(self->lineno);[](#l4.96)
Py_INCREF(PyTuple_GET_ITEM(info, 1));[](#l4.97)
Py_SETREF(self->lineno, PyTuple_GET_ITEM(info, 1));[](#l4.98)
Py_CLEAR(self->offset);[](#l4.100)
self->offset = PyTuple_GET_ITEM(info, 2);[](#l4.101)
Py_INCREF(self->offset);[](#l4.102)
Py_INCREF(PyTuple_GET_ITEM(info, 2));[](#l4.103)
Py_SETREF(self->offset, PyTuple_GET_ITEM(info, 2));[](#l4.104)
Py_CLEAR(self->text);[](#l4.106)
self->text = PyTuple_GET_ITEM(info, 3);[](#l4.107)
Py_INCREF(self->text);[](#l4.108)
Py_INCREF(PyTuple_GET_ITEM(info, 3));[](#l4.109)
Py_SETREF(self->text, PyTuple_GET_ITEM(info, 3));[](#l4.110)
Py_DECREF(info); } @@ -1327,8 +1315,7 @@ set_string(PyObject **attr, const char * PyObject *obj = PyString_FromString(value); if (!obj) return -1;