diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 07:52:27 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 07:52:27 (GMT) |
commit | b1ed7fac12fe51080c06e518a9fcaa21f0734744 (patch) | |
tree | 62ec01511606af98540d5b78bb24b2b848f4064e /Python | |
parent | 2a19074a9c58d491712139cd3607c10fddebbebc (diff) | |
download | cpython-b1ed7fac12fe51080c06e518a9fcaa21f0734744.zip cpython-b1ed7fac12fe51080c06e518a9fcaa21f0734744.tar.gz cpython-b1ed7fac12fe51080c06e518a9fcaa21f0734744.tar.bz2 |
Replace INT_MAX with PY_SSIZE_T_MAX.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 5 | ||||
-rw-r--r-- | Python/codecs.c | 10 | ||||
-rw-r--r-- | Python/modsupport.c | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index fe923ac..27b4811 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1746,14 +1746,13 @@ builtin_raw_input(PyObject *self, PyObject *args) } else { /* strip trailing '\n' */ size_t len = strlen(s); - if (len > INT_MAX) { + if (len > PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, "[raw_]input: input too long"); result = NULL; } else { - result = PyString_FromStringAndSize(s, - (int)(len-1)); + result = PyString_FromStringAndSize(s, len-1); } } PyMem_FREE(s); diff --git a/Python/codecs.c b/Python/codecs.c index e2bb8fc..2124824 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -56,12 +56,12 @@ PyObject *normalizestring(const char *string) char *p; PyObject *v; - if (len > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, "string is too large"); - return NULL; - } + if (len > PY_SSIZE_T_MAX) { + PyErr_SetString(PyExc_OverflowError, "string is too large"); + return NULL; + } - v = PyString_FromStringAndSize(NULL, (int)len); + v = PyString_FromStringAndSize(NULL, len); if (v == NULL) return NULL; p = PyString_AS_STRING(v); diff --git a/Python/modsupport.c b/Python/modsupport.c index 77a25ea..65480c8 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -407,7 +407,7 @@ do_mkvalue(const char **p_format, va_list *p_va) else { if (n < 0) { size_t m = strlen(str); - if (m > INT_MAX) { + if (m > PY_SSIZE_T_MAX) { PyErr_SetString(PyExc_OverflowError, "string too long for Python string"); return NULL; |