Issue #20440: Massive replacing unsafe attribute setting code with special

macro Py_SETREF.
This commit is contained in:
Serhiy Storchaka 2015-12-24 10:35:59 +02:00
parent a198645fa0
commit 5a57ade58e
28 changed files with 92 additions and 120 deletions

View file

@ -276,9 +276,8 @@ _set_str(const char *name, PyObject **target, PyObject *src, const char *dflt)
else {
if (PyUnicode_READY(src) == -1)
return -1;
Py_XDECREF(*target);
Py_INCREF(src);
*target = src;
Py_SETREF(*target, src);
}
}
return 0;
@ -784,8 +783,7 @@ parse_process_char(ReaderObj *self, Py_UCS4 c)
static int
parse_reset(ReaderObj *self)
{
Py_XDECREF(self->fields);
self->fields = PyList_New(0);
Py_SETREF(self->fields, PyList_New(0));
if (self->fields == NULL)
return -1;
self->field_len = 0;