File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -3563,8 +3563,9 @@ impl Compiler {
3563
3563
}
3564
3564
3565
3565
// Validate and compile keys
3566
- use std:: collections:: HashSet ;
3567
- let mut seen = HashSet :: new ( ) ;
3566
+ // NOTE: RustPython difference - using HashSet<String> for duplicate checking
3567
+ // CPython uses PySet with actual Python objects
3568
+ let mut seen = std:: collections:: HashSet :: new ( ) ;
3568
3569
3569
3570
for key in keys. iter ( ) {
3570
3571
// Validate key
Original file line number Diff line number Diff line change @@ -680,8 +680,8 @@ impl ExecutingFrame<'_> {
680
680
bytecode:: Instruction :: StoreSubscript => self . execute_store_subscript ( vm) ,
681
681
bytecode:: Instruction :: DeleteSubscript => self . execute_delete_subscript ( vm) ,
682
682
bytecode:: Instruction :: CopyItem { index } => {
683
- // CopyItem { index: 1 } copies TOS (like Python's COPY 1)
684
- // CopyItem { index: 2 } copies second from top (like Python's COPY 2)
683
+ // CopyItem { index: 1 } copies TOS
684
+ // CopyItem { index: 2 } copies second from top
685
685
// This is 1-indexed to match CPython
686
686
let idx = index. get ( arg) as usize ;
687
687
let value = self
@@ -705,7 +705,7 @@ impl ExecutingFrame<'_> {
705
705
let index_val = index. get ( arg) as usize ;
706
706
// CPython: SWAP(n) swaps TOS with PEEK(n) where PEEK(n) = stack_pointer[-n]
707
707
// This means swap TOS with the element at index (len - n)
708
- let j = len. saturating_sub ( index_val) ;
708
+ let j = len - index_val;
709
709
self . state . stack . swap ( i, j) ;
710
710
Ok ( None )
711
711
}
You can’t perform that action at this time.
0 commit comments