Handle Python 3.11 exception opcodes in AST builder#599
Merged
zrax merged 2 commits intozrax:masterfrom Apr 7, 2026
Merged
Conversation
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.
What changed
PUSH_EXC_INFOCHECK_EXC_MATCHRERAISERERAISE_ABEFORE_WITHCHECK_EXC_MATCHtoASTCompare::CMP_EXCEPTIONtry/exceptblock structure from Python 3.11 exception table entries when legacy setup opcodes are absentRERAISEcleanup opcodes as internal control-flow cleanup rather than emitted source statementstry/exceptWhy this changed
The AST builder did not recognize several Python 3.11 exception opcodes, and it also relied on legacy setup opcodes that are no longer present in 3.11 bytecode. That meant decompilation could stop early, lose
exceptclauses, or emit cleanup artifacts instead of validtry/exceptsource.Impact
try/exceptstructure from exception-table driven bytecodeValidation
ASTree.cpp/Users/miyazakidaichi/anaconda3/envs/dits2/lib/python3.11/site-packages/cmake/data/bin/cmake -S /Users/miyazakidaichi/Nextcloud/dev/tmp_pycdc -B /tmp/tmp_pycdc_build_codexmake -C /tmp/tmp_pycdc_build_codex -j4python3 /Users/miyazakidaichi/Nextcloud/dev/tmp_pycdc/tests/run_tests.py --filter test_exception_match_py311 --jobs 1make -C /tmp/tmp_pycdc_build_codex check JOBS=4XFAIL) cases still appear in the suite output