Skip to content

gh-152156: Fix a crash in interpeters.create under limited memory conditions - #152163

Merged
sobolevn merged 1 commit into
python:mainfrom
sobolevn:issue-152156
Jun 26, 2026
Merged

gh-152156: Fix a crash in interpeters.create under limited memory conditions#152163
sobolevn merged 1 commit into
python:mainfrom
sobolevn:issue-152156

Conversation

@sobolevn

@sobolevnsobolevn commented Jun 25, 2026

Copy link
Copy Markdown
Member

In handle_channel_error we already set an error. When called the second time, we get end up with err == 0 and run this code:

if (err==0) {
assert(!PyErr_Occurred());
return0;
}

which will fail, because exception was already set by the first error. So, there's no need to call it twice.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Are you sure that channel_destroy can not clear error?

@sobolevn

Copy link
Copy Markdown
MemberAuthor

PyErr_Clear can be called in _release_xid_data under XID_IGNORE_EXC, but it resets the previous error correctly. I don't see any real ways to clear it.

PyErr_GetRaisedException and PyErr_Clear are only used in _release_xid_data in this path.

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@sobolevn
sobolevn merged commit 3ad66bf into python:mainJun 26, 2026
58 checks passed
@sobolevnsobolevn added awaiting merge needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 26, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@bedevere-app

Copy link
Copy Markdown

GH-152268 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Jun 26, 2026
@bedevere-app

Copy link
Copy Markdown

GH-152269 is a backport of this pull request to the 3.15 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 26, 2026
@bedevere-app

Copy link
Copy Markdown

GH-152270 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Jun 26, 2026
sobolevn added a commit that referenced this pull request Jun 26, 2026
…emory conditions (GH-152163) (#152268)
gh-152156: Fix a crash in `interpeters.create` under limited memory conditions (GH-152163)
(cherry picked from commit 3ad66bf)
Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request Jun 26, 2026
…emory conditions (GH-152163) (#152269)
gh-152156: Fix a crash in `interpeters.create` under limited memory conditions (GH-152163)
(cherry picked from commit 3ad66bf)
Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request Jun 27, 2026
…emory conditions (GH-152163) (#152270)
gh-152156: Fix a crash in `interpeters.create` under limited memory conditions (GH-152163)
(cherry picked from commit 3ad66bf)
Co-authored-by: sobolevn <mail@sobolevn.me>
Sign up for freeto 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.

2 participants

@sobolevn@serhiy-storchaka