gh-149459: Fix segfault when _LOAD_SPECIAL guard deoptimizes#149478
Merged
kumaraditya303 merged 6 commits intopython:mainfrom May 8, 2026
Merged
gh-149459: Fix segfault when _LOAD_SPECIAL guard deoptimizes#149478kumaraditya303 merged 6 commits intopython:mainfrom
kumaraditya303 merged 6 commits intopython:mainfrom
Conversation
Documentation build overview
26 files changed ·
|
markshannon
approved these changes
May 7, 2026
Member
markshannon
left a comment
There was a problem hiding this comment.
Looks good. Thanks for fixing this
kumaraditya303
approved these changes
May 8, 2026
|
Thanks @cocolato for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-149552 is a backport of this pull request to the 3.15 branch. |
kumaraditya303
pushed a commit
that referenced
this pull request
May 8, 2026
…GH-149478) (#149552) gh-149459: Fix segfault when `_LOAD_SPECIAL` guard deoptimizes (GH-149478) (cherry picked from commit c341e34) Co-authored-by: Hai Zhu <haiizhu@outlook.com>
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.
LOAD_SPECIALexpands as:_RECORD_TOS_TYPE + _INSERT_NULL + _LOAD_SPECIAL_INSERT_NULLalters the actual stack structure:Before modification:
[..., self]After modification:
[..., NULL, self]The optimizer has introduced
_GUARD_TYPE_VERSION. If a guard is placed after_INSERT_NULL, and the guard fails resulting in a side exit, the interpreter will deopt back to the originalLOAD_SPECIAL. However, by this point, the stack has already been modified by_INSERT_NULLto[..., NULL, self]._PyObject_LookupSpecialMethod#149459