GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove JUMP_IF_NOT_EXC_MATCH, SET_EXC_INFO by youknowone · Pull Request #6820 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Jan 20, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Simplified exception handling bytecode by removing redundant operations and consolidating exception matching logic.
    • Streamlined exception handler control flow for improved runtime efficiency.
    • Enhanced exception type validation to ensure exceptions properly inherit from BaseException.

✏️ Tip: You can customize this high-level summary in your review settings.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Jan 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR refactors exception handling bytecode by removing JumpIfNotExcMatch and SetExcInfo opcodes. Exception matching logic is consolidated into CheckExcMatch, which now sets the matched exception as current, while PopJumpIfFalse replaces JumpIfNotExcMatch for conditional jumps. The bytecode instruction enum and related dispatch paths are simplified accordingly.

Changes

Cohort / File(s) Summary
Instruction variants removal
crates/compiler-core/src/bytecode/instruction.rs
Removed public enum variants JumpIfNotExcMatch(Arg<Label>) and SetExcInfo from Instruction. Removed their handling from TryFrom<u8>, InstructionMetadata (label_arg, stack_effect, fmt_dis), and formatting/disassembly paths.
Code generation updates
crates/codegen/src/compile.rs
Replaced duplicated exception-copy sequence with inline CheckExcMatch and PopJumpIfFalse for per-handler exception matching. Removed SetExcInfo emission since CheckExcMatch now sets the matched exception as current.
VM execution logic
crates/vm/src/frame.rs
Removed implementations of Instruction::JumpIfNotExcMatch and Instruction::SetExcInfo. Enhanced CheckExcMatch with BaseException inheritance validation. Updated CHECK_EG_MATCH to set VM's current exception to matched exception after exception_group_match.
Opcode classification
crates/stdlib/src/opcode.rs
Removed JumpIfNotExcMatch from has_jump() match arms, narrowing the set of jump-classified instructions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Sort Instruction enum & related match arms #6322: Directly modifies the same bytecode instruction surface with exception handling and CheckExcMatch-based logic.
  • Split TestOperator instruction #6306: Directly reverses or modifies the same exception-match machinery including JumpIfNotExcMatch and SetExcInfo handling.
  • New Instruction ToBool,PopJumpIfFalse #6112: Related through codegen changes that emit PopJumpIfFalse for conditional jumps in compile.rs.

Suggested reviewers

  • ShaharNaveh

Poem

🐰 With CheckExcMatch we hop more true,
SetExcInfo and JumpIfNot—adieu!
PopJumpIfFalse now bears the load,
Exception paths on cleaner road! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main change: removal of two instruction variants (JUMP_IF_NOT_EXC_MATCH and SET_EXC_INFO) from the codebase, which is clearly reflected across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
SetExcInfo
48826b6
@youknowone
youknowone force-pushed the set-exc-info branch from ebb4c36 to 48826b6 Compare January 20, 2026 15:26
@youknowone
youknowone marked this pull request as ready for review January 20, 2026 16:15
@youknowone
youknowone merged commit 274e8b4 into RustPython:main Jan 20, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone deleted the set-exc-info branch January 20, 2026 16:23
@coderabbitai coderabbitai Bot mentioned this pull request Feb 1, 2026
Rework exception compiler #6909
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Feb 23, 2026
cold block reordering and jump normalization #7210
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@youknowone
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.