Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-111784: AddPyCapsule_ImportCapsule and fix segfault in_elementtree.c#112053
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Eclips4 commentedNov 14, 2023
@mgorny can you confirm that this fixes the issue? |
| "PyCapsule_Import \"%s\" is not valid", | ||
| name); | ||
| } | ||
| EXIT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We don't need herePy_XDECREF(object) as in thePyCapsule_Import, because we do it later manually. So, we can control a process of capsule's deallocation
mgorny commentedNov 14, 2023
Eclips4 commentedNov 14, 2023
chgnrdv commentedNov 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@Eclips4, it is reduced but not minimal :) |
chgnrdv commentedNov 14, 2023
Other, a bit hacky repro: import_elementtreex=_elementtree.XMLParser()importsysdelsys.modules['pyexpat'] Looks obvious in hindsight, as all what we need is to deallocate |
| name); | ||
| } | ||
| EXIT: | ||
| if (name_dup) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
name_dup is always non-NULL here, as we returnMemoryError at line 236 ifPyMem_Malloc fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It's not a final version 😅
Currently we just talking about idea, sadly, but this solution is incorrect :(
FYI, it's just copied fromPyCapsule_Import
Eclips4 commentedNov 14, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yep, I thinking about the same. |
Eclips4 commentedDec 2, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This PR fixes only one segfault (there's two segfaults actually) and way to fix this segfault is really weird. So I'm closing this. |
Uh oh!
There was an error while loading.Please reload this page.
That's a PoC.
We can add a
NEWSentry and doc about new public API later, if we consider this as the right solution.Also, I was incorrect in issue. We need to keep reference to the capsule, not
pyexpatmodule._elementtree.XMLParser#111784