summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-08-15 23:03:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-08-15 23:03:39 (GMT)
commit706768c687f5413c909168736506aaf4fb4861c0 (patch)
tree98131f201f269d30031ed6e3c6d98fe4cf1fe649 /Modules/_struct.c
parent12174a5dcaf1bdcd8d5fd790a8cad07049bddce6 (diff)
downloadcpython-706768c687f5413c909168736506aaf4fb4861c0.zip
cpython-706768c687f5413c909168736506aaf4fb4861c0.tar.gz
cpython-706768c687f5413c909168736506aaf4fb4861c0.tar.bz2
Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 4941fc8..06f0d3a 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -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;
}