summaryrefslogtreecommitdiff
path: root/Modules/_codecsmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-08-17 22:20:00 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-08-17 22:20:00 +0200
commit049e509a9f87d1f82ae0ebfe21c226f37ce9fbdb (patch)
tree96885f696a33000548163e8b4bab6415dd842dde /Modules/_codecsmodule.c
parentdaca3d7e9b48badf02521df1b729ddd2733b2d77 (diff)
downloadcpython-git-049e509a9f87d1f82ae0ebfe21c226f37ce9fbdb.tar.gz
Issue #22207: Fix "comparison between signed and unsigned integers" warning in
test checking for integer overflow on Py_ssize_t type: cast explicitly to size_t.
Diffstat (limited to 'Modules/_codecsmodule.c')
-rw-r--r--Modules/_codecsmodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index 1b21300c8d..ac25998d7b 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -699,7 +699,7 @@ unicode_internal_encode(PyObject *self,
u = PyUnicode_AsUnicodeAndSize(obj, &len);
if (u == NULL)
return NULL;
- if (len > PY_SSIZE_T_MAX / sizeof(Py_UNICODE))
+ if ((size_t)len > (size_t)PY_SSIZE_T_MAX / sizeof(Py_UNICODE))
return PyErr_NoMemory();
size = len * sizeof(Py_UNICODE);
return codec_tuple(PyBytes_FromStringAndSize((const char*)u, size),