Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
Add i64 test case
  • Loading branch information
JukkaL committed Jan 15, 2026
commit fbd4886e7fdb622ee1d3c575ffac166a6f88a380
19 changes: 19 additions & 0 deletions mypyc/test-data/irbuild-str.test
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ def ord_str_index_to_i16(s: str, i: i64) -> i16:
return ord(s[i])
def ord_str_index_to_u8(s: str, i: i64) -> u8:
return ord(s[i])
def ord_str_index_to_i64(s: str, i: i64) -> i64:
return ord(s[i])
[typing fixtures/typing-full.pyi]
[out]
def ord_str_index(s, i):
Expand Down Expand Up @@ -667,6 +669,23 @@ L5:
unreachable
L6:
return r8
def ord_str_index_to_i64(s, i):
s :: str
i, r0 :: i64
r1, r2 :: bool
r3 :: short_int
r4 :: i64
L0:
r0 = CPyStr_AdjustIndex(s, i)
r1 = CPyStr_RangeCheck(s, r0)
if r1 goto L2 else goto L1 :: bool
L1:
r2 = raise IndexError('index out of range')
unreachable
L2:
r3 = CPyStr_GetItemUnsafeAsInt(s, r0)
r4 = r3 >> 1
return r4

[case testStrip]
from typing import NewType, Union
Expand Down