]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] GH-149501: Fix compilation warning in `_YIELD_VALUE` uop (GH-149502) (#149737)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 12 May 2026 17:58:31 +0000 (19:58 +0200)
committerGitHub <noreply@github.com>
Tue, 12 May 2026 17:58:31 +0000 (17:58 +0000)
GH-149501: Fix compilation warning in `_YIELD_VALUE` uop (GH-149502)
(cherry picked from commit 1a79fd0ad650f0a0f21f653cc46a89bc1741d253)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Modules/_testinternalcapi/test_cases.c.h
Python/bytecodes.c
Python/executor_cases.c.h
Python/generated_cases.c.h

index 238e17bea303d3524aa4c99f22b976eb3332ca80..a2506524f0bb6dc34a7fe1d195c7857227fcca3c 100644 (file)
                 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
                 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
index 3bd489122da9d42d67da3fc2043f7171d8be4fa5..f7487c7136962f15acbdf2e99aa6c433923e692d 100644 (file)
@@ -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
index b6a2821db3007efe793f10ce12d928b092555aad..efa61d7de74e88c13068bf5f6672d6f4a2d8259c 100644 (file)
             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
index 2623105656c90c35695c6c12ba826fa7ada4f2ea..53e09a8f4523c7c92f97f97d67228404a281cdd5 100644 (file)
                 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
                 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