mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20440: Massive replacing unsafe attribute setting code with special
macro Py_SETREF.
This commit is contained in:
parent
a198645fa0
commit
5a57ade58e
28 changed files with 92 additions and 120 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue