summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-27 13:51:32 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-27 13:51:32 (GMT)
commit1ed017ae92b32b27186d5793f6e58c526f350a2b (patch)
tree05fec1ee9e107911f46d85f86efcabce50ff5680 /Modules/_elementtree.c
parent726fc139a5f40d81a0013c856be1283da08de4a0 (diff)
downloadcpython-1ed017ae92b32b27186d5793f6e58c526f350a2b.zip
cpython-1ed017ae92b32b27186d5793f6e58c526f350a2b.tar.gz
cpython-1ed017ae92b32b27186d5793f6e58c526f350a2b.tar.bz2
Issue #20440: Cleaning up the code by using Py_SETREF and Py_CLEAR.
Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner. This patch doesn't fix bugs and hence there is no need to backport it.
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index f16d48f..580c53a 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -2338,13 +2338,9 @@ _elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
PyObject *element_factory)
/*[clinic end generated code: output=91cfa7558970ee96 input=1b424eeefc35249c]*/
{
- PyObject *tmp;
-
if (element_factory) {
Py_INCREF(element_factory);
- tmp = self->element_factory;
- self->element_factory = element_factory;
- Py_XDECREF(tmp);
+ Py_SETREF(self->element_factory, element_factory);
}
return 0;