gh-111784: Fix two segfaults#113405
Merged
serhiy-storchaka merged 5 commits intopython:mainfrom Dec 24, 2023
Merged
Conversation
Member
Author
|
@mgorny Can you confirm that problem is resolved now? |
Member
Author
|
Also, I check it for reference leaks: ./python.exe -m test -R 3:3 test_xml_etree_c
Using random seed: 1167552768
0:00:00 load avg: 2.77 Run 1 test sequentially
0:00:00 load avg: 2.77 [1/1] test_xml_etree_c
beginning 6 repetitions
123456
......
== Tests result: SUCCESS ==
1 test OK.
Total duration: 2.7 sec
Total tests: run=208 skipped=6
Total test files: run=1/1
Result: SUCCESS |
Contributor
|
Thanks! I can confirm that with this patch, slixmpp's test suite passes without segfaults on top of Python 3.12. |
serhiy-storchaka
approved these changes
Dec 23, 2023
Member
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM.
Yes, add a NEWS entry, please.
Member
Author
Done. |
serhiy-storchaka
approved these changes
Dec 23, 2023
Misc/NEWS.d/next/Library/2023-12-23-13-10-42.gh-issue-111784.Nb4L1j.rst
Outdated
Show resolved
Hide resolved
|
Thanks @Eclips4 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
GH-113446 is a backport of this pull request to the 3.12 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Dec 24, 2023
…H-113405) First fix resolve situation when pyexpat module (which contains expat_CAPI capsule) deallocates before _elementtree, so we need to hold a strong reference to pyexpat module to. Second fix resolve situation when module state is deallocated before deallocation of XMLParser instances, which uses module state to clear some stuff. (cherry picked from commit 894f0e5) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
serhiy-storchaka
pushed a commit
that referenced
this pull request
Dec 24, 2023
) (GH-113446) First fix resolve situation when pyexpat module (which contains expat_CAPI capsule) deallocates before _elementtree, so we need to hold a strong reference to pyexpat module to. Second fix resolve situation when module state is deallocated before deallocation of XMLParser instances, which uses module state to clear some stuff. (cherry picked from commit 894f0e5) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Member
Author
|
Thanks Serhiy for your review! |
ryan-duve
pushed a commit
to ryan-duve/cpython
that referenced
this pull request
Dec 26, 2023
…H-113405) First fix resolve situation when pyexpat module (which contains expat_CAPI capsule) deallocates before _elementtree, so we need to hold a strong reference to pyexpat module to. Second fix resolve situation when module state is deallocated before deallocation of XMLParser instances, which uses module state to clear some stuff.
kulikjak
pushed a commit
to kulikjak/cpython
that referenced
this pull request
Jan 22, 2024
…H-113405) First fix resolve situation when pyexpat module (which contains expat_CAPI capsule) deallocates before _elementtree, so we need to hold a strong reference to pyexpat module to. Second fix resolve situation when module state is deallocated before deallocation of XMLParser instances, which uses module state to clear some stuff.
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
…H-113405) First fix resolve situation when pyexpat module (which contains expat_CAPI capsule) deallocates before _elementtree, so we need to hold a strong reference to pyexpat module to. Second fix resolve situation when module state is deallocated before deallocation of XMLParser instances, which uses module state to clear some stuff.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
…H-113405) First fix resolve situation when pyexpat module (which contains expat_CAPI capsule) deallocates before _elementtree, so we need to hold a strong reference to pyexpat module to. Second fix resolve situation when module state is deallocated before deallocation of XMLParser instances, which uses module state to clear some stuff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains two fixes.
First fix resolve situation when
pyexpatmodule (which containsexpat_CAPIcapsule) deallocates before_elementtree, so we need to hold a strong reference topyexpatmodule to.Second fix resolve situation when module state is deallocated before deallocation of
XMLParserinstances, which uses module state to clear some stuff.(I'll write a
NEWSentry later, if it is necessary)_elementtree.XMLParser#111784