[Python-checkins] cpython: Fix compiler warnings: comparison between signed and unsigned numbers
victor.stinner
python-checkins at python.org
Fri Mar 20 11:37:37 CET 2015
https://hg.python.org/cpython/rev/a6f4e1690f70
changeset: 95090:a6f4e1690f70
user: Victor Stinner <victor.stinner at gmail.com>
date: Fri Mar 20 11:32:24 2015 +0100
summary:
Fix compiler warnings: comparison between signed and unsigned numbers
files:
Modules/socketmodule.c | 2 +-
Objects/unicodeobject.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1738,7 +1738,7 @@
return 0;
}
- if (PyBytes_GET_SIZE(ctl_name) > sizeof(info.ctl_name)) {
+ if (PyBytes_GET_SIZE(ctl_name) > (Py_ssize_t)sizeof(info.ctl_name)) {
PyErr_SetString(PyExc_ValueError,
"provided string is too long");
Py_DECREF(ctl_name);
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4799,7 +4799,7 @@
/* Note: size will always be longer than the resulting Unicode
character count */
- if (PY_SSIZE_T_MAX / sizeof(wchar_t) < (size + 1))
+ if (PY_SSIZE_T_MAX / (Py_ssize_t)sizeof(wchar_t) < (size + 1))
return NULL;
unicode = PyMem_RawMalloc((size + 1) * sizeof(wchar_t));
if (!unicode)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list