summaryrefslogtreecommitdiff
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-01-05 21:27:54 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-01-05 21:27:54 +0200
commit576f132b986b5ee60e4b84d34a519a5edcd8c03e (patch)
treef048292ddc0b5c3d6a5afc50dc2cd4b28372c655 /Objects/typeobject.c
parentdcf76c9d0ab11f77eaa856ff0583c5c636ddb47d (diff)
downloadcpython-git-576f132b986b5ee60e4b84d34a519a5edcd8c03e.tar.gz
Issue #20440: Cleaning up the code by using Py_SETREF.
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index c62255c5b0..db15cf6768 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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;
}