Skip to content

gh-146102:Fix cross-interpreter NotShareableError ref handling#151578

Open
lpyu001 wants to merge 1 commit into
python:mainfrom
lpyu001:fix-crossinterp.c-bug2
Open

gh-146102:Fix cross-interpreter NotShareableError ref handling#151578
lpyu001 wants to merge 1 commit into
python:mainfrom
lpyu001:fix-crossinterp.c-bug2

Conversation

@lpyu001

@lpyu001 lpyu001 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This fixes two ownership issues:

  • _ensure_notshareableerror() now returns immediately when the current raised exception is already a NotShareableError. The function had restored ctx to the thread state but then continued using it, even though ownership had been handed back.
  • _PyXI_UnwrapNotShareableError() now decrefs the exception taken from the thread state if _PyXI_InitFailure() fails, avoiding a leaked exception reference on that error path.

The _pop_preserved() shadowed-variable leak is already fixed on this branch, so this PR does not touch it.

glist:https://gist.github.com/devdanzin/a56b8cb579b1950b4206e8a42d6be650

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant