From: Ken Jin Date: Fri, 27 Jun 2025 16:18:44 +0000 (+0800) Subject: gh-132732: JIT: Only allow compact ints in pure evaluation (GH-136040) X-Git-Tag: v3.15.0a1~1153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c419af9e277bea7dd78f4defefc752fe93b0b8ec;p=thirdparty%2FPython%2Fcpython.git gh-132732: JIT: Only allow compact ints in pure evaluation (GH-136040) --- diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c index e4dbca8362f4..bd3ec615d085 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);