summaryrefslogtreecommitdiffstats
path: root/Python/codegen.c
diff options
context:
space:
mode:
authorYan Yanchii <yyanchiy@gmail.com>2025-02-04 08:10:55 (GMT)
committerGitHub <noreply@github.com>2025-02-04 08:10:55 (GMT)
commit0664c1af9b29a5af2404e04a522f8e9e175ba05a (patch)
tree280d19751c46e05e8c7796910120e475d5f79553 /Python/codegen.c
parentbb5c6875d6e84bf2b4e134ed482141a51d223f09 (diff)
downloadcpython-0664c1af9b29a5af2404e04a522f8e9e175ba05a.zip
cpython-0664c1af9b29a5af2404e04a522f8e9e175ba05a.tar.gz
cpython-0664c1af9b29a5af2404e04a522f8e9e175ba05a.tar.bz2
gh-126835: Move constant subscript folding to CFG (#129568)
Move folding of constant subscription from AST optimizer to CFG. Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Python/codegen.c')
-rw-r--r--Python/codegen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/codegen.c b/Python/codegen.c
index 0bf9526..e9853d7 100644
--- a/Python/codegen.c
+++ b/Python/codegen.c
@@ -284,7 +284,7 @@ codegen_addop_load_const(compiler *c, location loc, PyObject *o)
if (PyLong_CheckExact(o)) {
int overflow;
long val = PyLong_AsLongAndOverflow(o, &overflow);
- if (!overflow && val >= 0 && val < 256 && val < _PY_NSMALLPOSINTS) {
+ if (!overflow && _PY_IS_SMALL_INT(val)) {
ADDOP_I(c, loc, LOAD_SMALL_INT, val);
return SUCCESS;
}