diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 250e2d12a9de0b..e180613eae2526 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -39,6 +39,8 @@ #include "pydtrace.h" #include "setobject.h" +#include // ptrdiff_t + #define USE_COMPUTED_GOTOS 0 #include "ceval_macros.h" @@ -2207,8 +2209,8 @@ dummy_func( *value_ptr = PyStackRef_AsPyObjectSteal(value); if (old_value == NULL) { PyDictValues *values = _PyObject_InlineValues(owner_o); - int index = value_ptr - values->values; - _PyDictValues_AddToInsertionOrder(values, index); + ptrdiff_t index = value_ptr - values->values; + _PyDictValues_AddToInsertionOrder(values, (Py_ssize_t)index); } else { Py_DECREF(old_value); diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 55b06a0e235dac..e7ca608d97d2fa 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -2594,8 +2594,8 @@ *value_ptr = PyStackRef_AsPyObjectSteal(value); if (old_value == NULL) { PyDictValues *values = _PyObject_InlineValues(owner_o); - int index = value_ptr - values->values; - _PyDictValues_AddToInsertionOrder(values, index); + ptrdiff_t index = value_ptr - values->values; + _PyDictValues_AddToInsertionOrder(values, (Py_ssize_t)index); } else { Py_DECREF(old_value); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 13bbff29d09133..eff5beda30f9f5 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -6839,8 +6839,8 @@ *value_ptr = PyStackRef_AsPyObjectSteal(value); if (old_value == NULL) { PyDictValues *values = _PyObject_InlineValues(owner_o); - int index = value_ptr - values->values; - _PyDictValues_AddToInsertionOrder(values, index); + ptrdiff_t index = value_ptr - values->values; + _PyDictValues_AddToInsertionOrder(values, (Py_ssize_t)index); } else { Py_DECREF(old_value);