Commit 1451874e authored by Serhiy Storchaka's avatar Serhiy Storchaka

Backed out changeset 78bf34b6a713

parent f939b3c0
...@@ -17,7 +17,6 @@ def sanity(): ...@@ -17,7 +17,6 @@ def sanity():
""" """
@unittest.skipUnless(cET, 'requires _elementtree')
class MiscTests(unittest.TestCase): class MiscTests(unittest.TestCase):
# Issue #8651. # Issue #8651.
@precisionbigmemtest(size=_2G + 100, memuse=1) @precisionbigmemtest(size=_2G + 100, memuse=1)
...@@ -63,22 +62,12 @@ class MiscTests(unittest.TestCase): ...@@ -63,22 +62,12 @@ class MiscTests(unittest.TestCase):
del element.attrib del element.attrib
self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'})
def test_trashcan(self):
# If this test fails, it will most likely die via segfault.
e = root = cET.Element('root')
for i in range(200000):
e = cET.SubElement(e, 'x')
del e
del root
test_support.gc_collect()
def test_main(): def test_main():
from test import test_xml_etree, test_xml_etree_c from test import test_xml_etree, test_xml_etree_c
# Run the tests specific to the C implementation # Run the tests specific to the C implementation
test_support.run_doctest(test_xml_etree_c, verbosity=True) test_support.run_doctest(test_xml_etree_c, verbosity=True)
test_support.run_unittest(MiscTests)
# Assign the C implementation before running the doctests # Assign the C implementation before running the doctests
# Patch the __name__, to prevent confusion with the pure Python test # Patch the __name__, to prevent confusion with the pure Python test
......
...@@ -26,8 +26,6 @@ Library ...@@ -26,8 +26,6 @@ Library
- Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. - Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict.
Original patch by Rasmus Villemoes. Original patch by Rasmus Villemoes.
- Issue #28871: Fixed a crash when deallocate deep ElementTree.
- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and
WeakValueDictionary.pop() when a GC collection happens in another WeakValueDictionary.pop() when a GC collection happens in another
thread. thread.
......
...@@ -121,18 +121,6 @@ typedef int Py_ssize_t; ...@@ -121,18 +121,6 @@ typedef int Py_ssize_t;
#define JOIN_SET(p, flag) ((void*) ((Py_uintptr_t) (JOIN_OBJ(p)) | (flag))) #define JOIN_SET(p, flag) ((void*) ((Py_uintptr_t) (JOIN_OBJ(p)) | (flag)))
#define JOIN_OBJ(p) ((PyObject*) ((Py_uintptr_t) (p) & ~1)) #define JOIN_OBJ(p) ((PyObject*) ((Py_uintptr_t) (p) & ~1))
/* Py_CLEAR for a PyObject* that uses a join flag. Pass the pointer by
* reference since this function sets it to NULL.
*/
static void _clear_joined_ptr(PyObject **p)
{
if (*p) {
PyObject *tmp = JOIN_OBJ(*p);
*p = NULL;
Py_DECREF(tmp);
}
}
/* glue functions (see the init function for details) */ /* glue functions (see the init function for details) */
static PyObject* elementtree_parseerror_obj; static PyObject* elementtree_parseerror_obj;
static PyObject* elementtree_copyelement_obj; static PyObject* elementtree_copyelement_obj;
...@@ -550,20 +538,17 @@ subelement(PyObject* self, PyObject* args, PyObject* kw) ...@@ -550,20 +538,17 @@ subelement(PyObject* self, PyObject* args, PyObject* kw)
static void static void
element_dealloc(ElementObject* self) element_dealloc(ElementObject* self)
{ {
Py_TRASHCAN_SAFE_BEGIN(self) if (self->extra)
element_dealloc_extra(self);
/* discard attributes */ /* discard attributes */
Py_DECREF(self->tag); Py_DECREF(self->tag);
_clear_joined_ptr(&self->text); Py_DECREF(JOIN_OBJ(self->text));
_clear_joined_ptr(&self->tail); Py_DECREF(JOIN_OBJ(self->tail));
if (self->extra)
element_dealloc_extra(self);
RELEASE(sizeof(ElementObject), "destroy element"); RELEASE(sizeof(ElementObject), "destroy element");
PyObject_Del(self); PyObject_Del(self);
Py_TRASHCAN_SAFE_END(self)
} }
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
......
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