Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
I think this should fix warnings.
  • Loading branch information
skirpichev authored Sep 18, 2024
1 parent 06b196b commit 3e8d296
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/_testcapi/long.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ pylongwriter_create(PyObject *module, PyObject *args)
}
Py_ssize_t ndigits = PyList_GET_SIZE(list);

digit *digits = PyMem_Malloc(ndigits * sizeof(digit));
digit *digits = PyMem_Malloc((size_t)ndigits * sizeof(digit));
if (digits == NULL) {
PyErr_NoMemory();
return NULL;
Expand Down Expand Up @@ -258,7 +258,7 @@ pylongwriter_create(PyObject *module, PyObject *args)
goto error;
}
assert(PyLong_GetNativeLayout()->digit_size == sizeof(digit));
memcpy(writer_digits, digits, ndigits * sizeof(digit));
memcpy(writer_digits, digits, (size_t)ndigits * sizeof(digit));
PyObject *res = PyLongWriter_Finish(writer);
PyMem_Free(digits);

Expand Down

0 comments on commit 3e8d296

Please sign in to comment.