Commit 30c435cb authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix leaks in init_elementtree

parent 806a6572
......@@ -3069,8 +3069,10 @@ init_elementtree(void)
);
if (!PyRun_String(bootstrap, Py_file_input, g, NULL))
PyObject* bootstrap_ret;
if (!(bootstrap_ret = PyRun_String(bootstrap, Py_file_input, g, NULL)))
return;
Py_DECREF(bootstrap_ret);
elementpath_obj = PyDict_GetItemString(g, "ElementPath");
......@@ -3090,6 +3092,8 @@ init_elementtree(void)
elementtree_iter_obj = PyDict_GetItemString(g, "iter");
elementtree_itertext_obj = PyDict_GetItemString(g, "itertext");
Py_DECREF(g);
#if defined(USE_PYEXPAT_CAPI)
/* link against pyexpat, if possible */
expat_capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
......
# expected: reffail
# test is based on the cpython ElementTree doc
def test(ET):
xml_str = """<?xml version="1.0"?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment