Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix more code
  • Loading branch information
ShaharNaveh committed Jan 30, 2026
commit 5951499e6ee3616753f3ce6e95837b285d05116d
6 changes: 3 additions & 3 deletions crates/codegen/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustpython_compiler_core::{
bytecode::{
AnyInstruction, Arg, CodeFlags, CodeObject, CodeUnit, CodeUnits, ConstantData,
ExceptionTableEntry, InstrDisplayContext, Instruction, InstructionMetadata, Label, OpArg,
PseudoInstruction, PyCodeLocationInfoKind, StackEffect, encode_exception_table,
PseudoInstruction, PyCodeLocationInfoKind, encode_exception_table,
},
varint::{write_signed_varint, write_varint},
};
Expand Down Expand Up @@ -731,7 +731,7 @@ impl CodeInfo {
// is pop 2 push 1, not pop 1 push 0). We list those explicitly;
// the fallback under-pops and under-pushes, which is conservative
// (may miss optimisation opportunities but never miscompiles).
let effect = instr.stack_effect(u32::from(info.arg) as i32);
let effect = instr.stack_effect(info.arg.into()).effect();
let (pops, pushes) = match instr {
// --- pop 2, push 1 ---
Instruction::BinaryOp { .. }
Expand Down Expand Up @@ -864,7 +864,7 @@ impl CodeInfo {
let block = &self.blocks[block_idx];
for ins in &block.instructions {
let instr = &ins.instr;
let effect = instr.stack_effect(u32::from(ins.arg) as i32);
let effect = instr.stack_effect(ins.arg.into()).effect();
if DEBUG {
let display_arg = if ins.target == BlockIdx::NULL {
ins.arg
Expand Down
6 changes: 3 additions & 3 deletions crates/stdlib/src/_opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod _opcode {
use crate::vm::{
AsObject, PyObjectRef, PyResult, VirtualMachine,
builtins::{PyInt, PyIntRef},
bytecode::{AnyInstruction, Instruction, PseudoInstruction, StackEffect},
bytecode::{AnyInstruction, Instruction, InstructionMetadata, PseudoInstruction},
};
use core::ops::Deref;

Expand Down Expand Up @@ -182,7 +182,7 @@ mod _opcode {
v.class().name()
))
})?
.try_to_primitive::<i32>(vm)
.try_to_primitive::<u32>(vm)
})
.unwrap_or(Ok(0))?;

Expand All @@ -198,7 +198,7 @@ mod _opcode {
let opcode = Opcode::try_from_pyint(args.opcode, vm)?;

let _ = jump; // Python API accepts jump but it's not used
Ok(opcode.stack_effect(oparg))
Ok(opcode.stack_effect(oparg).into())
}

#[pyfunction]
Expand Down