https://github.com/python/cpython/commit/e2e9cea7692fdb0ac3e34fd38a25d9025035769f
commit: e2e9cea7692fdb0ac3e34fd38a25d9025035769f
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-05-12T17:58:31Z
summary:

[3.15] GH-149501: Fix compilation warning in `_YIELD_VALUE` uop (GH-149502) 
(#149737)

GH-149501: Fix compilation warning in `_YIELD_VALUE` uop (GH-149502)
(cherry picked from commit 1a79fd0ad650f0a0f21f653cc46a89bc1741d253)

Co-authored-by: Sergey Miryanov <[email protected]>

files:
M Modules/_testinternalcapi/test_cases.c.h
M Python/bytecodes.c
M Python/executor_cases.c.h
M Python/generated_cases.c.h

diff --git a/Modules/_testinternalcapi/test_cases.c.h 
b/Modules/_testinternalcapi/test_cases.c.h
index 238e17bea303d3..a2506524f0bb6d 100644
--- a/Modules/_testinternalcapi/test_cases.c.h
+++ b/Modules/_testinternalcapi/test_cases.c.h
@@ -7946,8 +7946,9 @@
                 assert(INLINE_CACHE_ENTRIES_SEND == 
INLINE_CACHE_ENTRIES_FOR_ITER);
                 #if TIER_ONE && defined(Py_DEBUG)
                 if (!PyStackRef_IsNone(frame->f_executable)) {
-                    int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
-                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
i).op.code;
+                    Py_ssize_t i = frame->instr_ptr - 
_PyFrame_GetBytecode(frame);
+                    assert(i >= 0 && i <= INT_MAX);
+                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
(int)i).op.code;
                     assert(opcode == SEND || opcode == FOR_ITER);
                 }
                 #endif
@@ -13056,8 +13057,9 @@
                 assert(INLINE_CACHE_ENTRIES_SEND == 
INLINE_CACHE_ENTRIES_FOR_ITER);
                 #if TIER_ONE && defined(Py_DEBUG)
                 if (!PyStackRef_IsNone(frame->f_executable)) {
-                    int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
-                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
i).op.code;
+                    Py_ssize_t i = frame->instr_ptr - 
_PyFrame_GetBytecode(frame);
+                    assert(i >= 0 && i <= INT_MAX);
+                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
(int)i).op.code;
                     assert(opcode == SEND || opcode == FOR_ITER);
                 }
                 #endif
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 3bd489122da9d4..f7487c7136962f 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1867,8 +1867,9 @@ dummy_func(
             assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
             #if TIER_ONE && defined(Py_DEBUG)
             if (!PyStackRef_IsNone(frame->f_executable)) {
-                int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
-                int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
i).op.code;
+                Py_ssize_t i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
+                assert(i >= 0 && i <= INT_MAX);
+                int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
(int)i).op.code;
                 assert(opcode == SEND || opcode == FOR_ITER);
             }
             #endif
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index b6a2821db3007e..efa61d7de74e88 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -9346,8 +9346,9 @@
             assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
             #if TIER_ONE && defined(Py_DEBUG)
             if (!PyStackRef_IsNone(frame->f_executable)) {
-                int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
-                int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
i).op.code;
+                Py_ssize_t i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
+                assert(i >= 0 && i <= INT_MAX);
+                int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
(int)i).op.code;
                 assert(opcode == SEND || opcode == FOR_ITER);
             }
             #endif
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 2623105656c90c..53e09a8f4523c7 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -7945,8 +7945,9 @@
                 assert(INLINE_CACHE_ENTRIES_SEND == 
INLINE_CACHE_ENTRIES_FOR_ITER);
                 #if TIER_ONE && defined(Py_DEBUG)
                 if (!PyStackRef_IsNone(frame->f_executable)) {
-                    int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
-                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
i).op.code;
+                    Py_ssize_t i = frame->instr_ptr - 
_PyFrame_GetBytecode(frame);
+                    assert(i >= 0 && i <= INT_MAX);
+                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
(int)i).op.code;
                     assert(opcode == SEND || opcode == FOR_ITER);
                 }
                 #endif
@@ -13053,8 +13054,9 @@
                 assert(INLINE_CACHE_ENTRIES_SEND == 
INLINE_CACHE_ENTRIES_FOR_ITER);
                 #if TIER_ONE && defined(Py_DEBUG)
                 if (!PyStackRef_IsNone(frame->f_executable)) {
-                    int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
-                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
i).op.code;
+                    Py_ssize_t i = frame->instr_ptr - 
_PyFrame_GetBytecode(frame);
+                    assert(i >= 0 && i <= INT_MAX);
+                    int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), 
(int)i).op.code;
                     assert(opcode == SEND || opcode == FOR_ITER);
                 }
                 #endif

_______________________________________________
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]

Reply via email to