diff --git a/Include/internal/pycore_optimizer.h b/Include/internal/pycore_optimizer.h index 8b7f12bf03d624..0d8fa2eb5799a5 100644 --- a/Include/internal/pycore_optimizer.h +++ b/Include/internal/pycore_optimizer.h @@ -332,8 +332,8 @@ extern bool _Py_uop_sym_is_bottom(JitOptRef sym); extern int _Py_uop_sym_truthiness(JitOptContext *ctx, JitOptRef sym); extern PyTypeObject *_Py_uop_sym_get_type(JitOptRef sym); extern JitOptRef _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args); -extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, int item); -extern int _Py_uop_sym_tuple_length(JitOptRef sym); +extern JitOptRef _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef sym, Py_ssize_t item); +extern Py_ssize_t _Py_uop_sym_tuple_length(JitOptRef sym); extern JitOptRef _Py_uop_sym_new_truthiness(JitOptContext *ctx, JitOptRef value, bool truthy); extern bool _Py_uop_sym_is_compact_int(JitOptRef sym); extern JitOptRef _Py_uop_sym_new_compact_int(JitOptContext *ctx); diff --git a/Misc/NEWS.d/next/Windows/2025-07-27-14-25-11.gh-issue-137136.xNthFT.rst b/Misc/NEWS.d/next/Windows/2025-07-27-14-25-11.gh-issue-137136.xNthFT.rst new file mode 100644 index 00000000000000..5c83af0ba71f59 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2025-07-27-14-25-11.gh-issue-137136.xNthFT.rst @@ -0,0 +1,2 @@ +Suppress build warnings when build on Windows with +``--experimental-jit-interpreter``. diff --git a/Python/bytecodes.c b/Python/bytecodes.c index d9abc4c53d1f50..52ef9b638ac73f 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -806,7 +806,7 @@ dummy_func( assert(next_instr->op.code == STORE_FAST); next_oparg = next_instr->op.arg; #else - next_oparg = CURRENT_OPERAND0(); + next_oparg = (int)CURRENT_OPERAND0(); #endif _PyStackRef *target_local = &GETLOCAL(next_oparg); assert(PyUnicode_CheckExact(left_o)); @@ -5246,7 +5246,8 @@ dummy_func( printf("SIDE EXIT: [UOp "); _PyUOpPrint(&next_uop[-1]); printf(", exit %lu, temp %d, target %d -> %s]\n", - exit - current_executor->exits, exit->temperature.value_and_backoff, + (unsigned long)(exit - current_executor->exits), + exit->temperature.value_and_backoff, (int)(target - _PyFrame_GetBytecode(frame)), _PyOpcode_OpName[target->op.code]); } diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index e152865e4ec9e8..1d5d0280e4294e 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -1232,7 +1232,7 @@ assert(next_instr->op.code == STORE_FAST); next_oparg = next_instr->op.arg; #else - next_oparg = CURRENT_OPERAND0(); + next_oparg = (int)CURRENT_OPERAND0(); #endif _PyStackRef *target_local = &GETLOCAL(next_oparg); assert(PyUnicode_CheckExact(left_o)); @@ -7122,7 +7122,8 @@ printf("SIDE EXIT: [UOp "); _PyUOpPrint(&next_uop[-1]); printf(", exit %lu, temp %d, target %d -> %s]\n", - exit - current_executor->exits, exit->temperature.value_and_backoff, + (unsigned long)(exit - current_executor->exits), + exit->temperature.value_and_backoff, (int)(target - _PyFrame_GetBytecode(frame)), _PyOpcode_OpName[target->op.code]); stack_pointer = _PyFrame_GetStackPointer(frame); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index aa1eb373b7ba4b..1b16af7da2c8d2 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -371,7 +371,7 @@ assert(next_instr->op.code == STORE_FAST); next_oparg = next_instr->op.arg; #else - next_oparg = CURRENT_OPERAND0(); + next_oparg = (int)CURRENT_OPERAND0(); #endif _PyStackRef *target_local = &GETLOCAL(next_oparg); assert(PyUnicode_CheckExact(left_o)); diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c index dd3e49b83d9971..c9ec34412767e1 100644 --- a/Python/optimizer_analysis.c +++ b/Python/optimizer_analysis.c @@ -645,7 +645,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size) opcode = buffer[pc].opcode = op_without_pop[opcode]; if (op_without_pop[last->opcode]) { opcode = last->opcode; - pc = last - buffer; + pc = (int)(last - buffer); } } else if (last->opcode == _PUSH_NULL) { diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index 77759f67532f80..781296dc7f48fc 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -316,7 +316,7 @@ dummy_func(void) { assert(PyLong_CheckExact(sym_get_const(ctx, sub_st))); long index = PyLong_AsLong(sym_get_const(ctx, sub_st)); assert(index >= 0); - int tuple_length = sym_tuple_length(tuple_st); + Py_ssize_t tuple_length = sym_tuple_length(tuple_st); if (tuple_length == -1) { // Unknown length res = sym_new_not_null(ctx); @@ -1166,9 +1166,9 @@ dummy_func(void) { op(_CALL_LEN, (callable, null, arg -- res)) { res = sym_new_type(ctx, &PyLong_Type); - int tuple_length = sym_tuple_length(arg); + Py_ssize_t tuple_length = sym_tuple_length(arg); if (tuple_length >= 0) { - PyObject *temp = PyLong_FromLong(tuple_length); + PyObject *temp = PyLong_FromSsize_t(tuple_length); if (temp == NULL) { goto error; } @@ -1182,13 +1182,13 @@ dummy_func(void) { } op(_GET_LEN, (obj -- obj, len)) { - int tuple_length = sym_tuple_length(obj); + Py_ssize_t tuple_length = sym_tuple_length(obj); if (tuple_length == -1) { len = sym_new_type(ctx, &PyLong_Type); } else { assert(tuple_length >= 0); - PyObject *temp = PyLong_FromLong(tuple_length); + PyObject *temp = PyLong_FromSsize_t(tuple_length); if (temp == NULL) { goto error; } diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 99206f01618d79..588f2dc503ca6b 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -936,7 +936,7 @@ assert(PyLong_CheckExact(sym_get_const(ctx, sub_st))); long index = PyLong_AsLong(sym_get_const(ctx, sub_st)); assert(index >= 0); - int tuple_length = sym_tuple_length(tuple_st); + Py_ssize_t tuple_length = sym_tuple_length(tuple_st); if (tuple_length == -1) { res = sym_new_not_null(ctx); } @@ -1897,13 +1897,13 @@ JitOptRef obj; JitOptRef len; obj = stack_pointer[-1]; - int tuple_length = sym_tuple_length(obj); + Py_ssize_t tuple_length = sym_tuple_length(obj); if (tuple_length == -1) { len = sym_new_type(ctx, &PyLong_Type); } else { assert(tuple_length >= 0); - PyObject *temp = PyLong_FromLong(tuple_length); + PyObject *temp = PyLong_FromSsize_t(tuple_length); if (temp == NULL) { goto error; } @@ -2616,9 +2616,9 @@ JitOptRef res; arg = stack_pointer[-1]; res = sym_new_type(ctx, &PyLong_Type); - int tuple_length = sym_tuple_length(arg); + Py_ssize_t tuple_length = sym_tuple_length(arg); if (tuple_length >= 0) { - PyObject *temp = PyLong_FromLong(tuple_length); + PyObject *temp = PyLong_FromSsize_t(tuple_length); if (temp == NULL) { goto error; } diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c index 8a3df236c80626..b1c4ddfe1d06d4 100644 --- a/Python/optimizer_symbols.c +++ b/Python/optimizer_symbols.c @@ -667,7 +667,7 @@ _Py_uop_sym_new_tuple(JitOptContext *ctx, int size, JitOptRef *args) } JitOptRef -_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, int item) +_Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, Py_ssize_t item) { JitOptSymbol *sym = PyJitRef_Unwrap(ref); assert(item >= 0); @@ -683,7 +683,7 @@ _Py_uop_sym_tuple_getitem(JitOptContext *ctx, JitOptRef ref, int item) return _Py_uop_sym_new_not_null(ctx); } -int +Py_ssize_t _Py_uop_sym_tuple_length(JitOptRef ref) { JitOptSymbol *sym = PyJitRef_Unwrap(ref);