From 41af942e57f9a450cf273ef6b72a21380c6ba8d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Wirtel?= Date: Mon, 12 Jun 2017 15:30:48 +0200 Subject: [PATCH] bpo-30615: Fix the leak reference in Modules/_elementtree.c (#2129) --- Modules/_elementtree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index b9e9b3aff8..929616f3e2 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1266,8 +1266,10 @@ element_repr(ElementObject* self) if (status == 0) { PyObject *repr, *tag; tag = PyObject_Repr(self->tag); - if (!tag) + if (!tag) { + Py_ReprLeave((PyObject *)self); return NULL; + } repr = PyString_FromFormat("", PyString_AS_STRING(tag), self); -- 2.50.0