-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
various refleaks in _elementtree, and crashes when using an uninitialized XMLParser object #75939
Comments
The following code results in refleaks: refcount_before = sys.gettotalrefcount()
parser.__init__(target=builder)
print(sys.gettotalrefcount() - refcount_before) # should be close to 0 This is because _elementtree_XMLParser___init___impl() The following code also results in refleaks: refcount_before = sys.gettotalrefcount()
elem.__setstate__({'tag': 42, '_children': []})
print(sys.gettotalrefcount() - refcount_before) # should be close to -1000 This is because element_setstate_from_attributes() doesn't decref the old I would open a PR to fix this soon. |
Shame on me. I only now found out that Serhiy already mentioned most of the refleaks |
According to Serhiy's advice (https://bugs.python.org/issue31455#msg304338), The following code crashes: This is because _elementtree_XMLParser_close_impl() assumes that the XMLParser ISTM that PR 3956 is more complex, and already not so small, so i would soon |
This has been pending for a while too long, but the fixes look good to me. They should still go at least into Py3.8 and later. |
Let's add it to the last bug fix release of 3.7 as well. It fixes a crash bug, after all. |
Thanks for the fix, Oren! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: