mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
This commit is contained in:
parent
12174a5dca
commit
706768c687
13 changed files with 24 additions and 21 deletions
|
@ -1263,7 +1263,8 @@ prepare_s(PyStructObject *self)
|
|||
const char *s;
|
||||
const char *fmt;
|
||||
char c;
|
||||
Py_ssize_t size, len, ncodes, num, itemsize;
|
||||
Py_ssize_t size, len, num, itemsize;
|
||||
size_t ncodes;
|
||||
|
||||
fmt = PyBytes_AS_STRING(self->s_format);
|
||||
|
||||
|
@ -1319,7 +1320,7 @@ prepare_s(PyStructObject *self)
|
|||
}
|
||||
|
||||
/* check for overflow */
|
||||
if ((ncodes + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) {
|
||||
if ((ncodes + 1) > ((size_t)PY_SSIZE_T_MAX / sizeof(formatcode))) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue