Skip to content

Commit

Permalink
pythongh-102939: Fix "conversion from Py_ssize_t to long" warning in …
Browse files Browse the repository at this point in the history
…builtins (pythonGH-102940)
  • Loading branch information
sobolevn committed Mar 23, 2023
1 parent 87be8d9 commit 0f2ba65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
Py_DECREF(iter);
if (PyErr_Occurred())
return NULL;
return PyLong_FromLong(i_result);
return PyLong_FromSsize_t(i_result);
}
if (PyLong_CheckExact(item) || PyBool_Check(item)) {
Py_ssize_t b;
Expand All @@ -2525,7 +2525,7 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
}
}
/* Either overflowed or is not an int. Restore real objects and process normally */
result = PyLong_FromLong(i_result);
result = PyLong_FromSsize_t(i_result);
if (result == NULL) {
Py_DECREF(item);
Py_DECREF(iter);
Expand Down

0 comments on commit 0f2ba65

Please sign in to comment.