https://github.com/python/cpython/commit/c419af9e277bea7dd78f4defefc752fe93b0b8ec
commit: c419af9e277bea7dd78f4defefc752fe93b0b8ec
branch: main
author: Ken Jin <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2025-06-28T00:18:44+08:00
summary:
gh-132732: JIT: Only allow compact ints in pure evaluation (GH-136040)
files:
M Python/optimizer_symbols.c
diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c
index e4dbca8362f4ce..bd3ec615d08592 100644
--- a/Python/optimizer_symbols.c
+++ b/Python/optimizer_symbols.c
@@ -206,9 +206,11 @@ _Py_uop_sym_is_safe_const(JitOptContext *ctx, JitOptRef
sym)
if (const_val == NULL) {
return false;
}
+ if (_PyLong_CheckExactAndCompact(const_val)) {
+ return true;
+ }
PyTypeObject *typ = Py_TYPE(const_val);
- return (typ == &PyLong_Type) ||
- (typ == &PyUnicode_Type) ||
+ return (typ == &PyUnicode_Type) ||
(typ == &PyFloat_Type) ||
(typ == &PyTuple_Type) ||
(typ == &PyBool_Type);
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]