Skip to content

[mypyc] Report error on converting out-of-range constant to native int - #22544

Merged
JukkaL merged 1 commit into
masterfrom
mypyc-native-int-literal-overflow
Nov 24, 2026
Merged

JukkaL merged 1 commit into
masterfrom
mypyc-native-int-literal-overflow

Conversation

@JukkaL

@JukkaL JukkaL commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Previously an explicit conversion such as u8(-1) or i64(2**63) silently truncated the constant at compile time, even though converting the same int value at runtime raises ValueError. Now it's a compile-time error, consistent with implicit conversions of out-of-range literals.

Previously an explicit conversion such as `u8(-1)` or `i64(2**63)`
silently truncated the constant at compile time, even though
converting the same int value at runtime raises ValueError. Now it's a
compile-time error, consistent with implicit conversions of
out-of-range literals.
@JukkaL
JukkaL merged commit 8e4b3c2 into master Nov 24, 2026
19 checks passed
@JukkaL
JukkaL deleted the mypyc-native-int-literal-overflow branch November 24, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants