mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Issue #20440: Cleaning up the code by using Py_SETREF.
This commit is contained in:
parent
dcf76c9d0a
commit
576f132b98
14 changed files with 39 additions and 120 deletions
|
@ -2092,7 +2092,7 @@ subtype_dict(PyObject *obj, void *context)
|
|||
static int
|
||||
subtype_setdict(PyObject *obj, PyObject *value, void *context)
|
||||
{
|
||||
PyObject *dict, **dictptr;
|
||||
PyObject **dictptr;
|
||||
PyTypeObject *base;
|
||||
|
||||
base = get_builtin_base_with_dict(Py_TYPE(obj));
|
||||
|
@ -2123,10 +2123,8 @@ subtype_setdict(PyObject *obj, PyObject *value, void *context)
|
|||
"not a '%.200s'", Py_TYPE(value)->tp_name);
|
||||
return -1;
|
||||
}
|
||||
dict = *dictptr;
|
||||
Py_XINCREF(value);
|
||||
*dictptr = value;
|
||||
Py_XDECREF(dict);
|
||||
Py_SETREF(*dictptr, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue