[issue28871] Destructor of ElementTree.Element is recursive

Serhiy Storchaka report at bugs.python.org
Wed Dec 28 02:13:14 EST 2016


Serhiy Storchaka added the comment:

Ah, I tested only with non-debug build in which asserts were ignored! In 2.7 Element doesn't support garbage collection, and the trashcan mechanism Py_TRASHCAN_SAFE_BEGIN/Py_TRASHCAN_SAFE_END can't be applied.

I see three alternatives:

1. Just revert the changes. Let deep ElementTree crashing.

2. Add the support of garbage collection. This will increase the size of empty Element by 1.5 times. This looks less appropriate that the first option since this harms working code.

3. Try to implement different mechanism. By using external list object as a stack or using other field for creating a linked list.

I'll revert the patch (except tests fix) and will try to implement different mechanism.

----------
stage: resolved -> needs patch
versions:  -Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28871>
_______________________________________


More information about the Python-bugs-list mailing list