diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 07:52:27 +0000 |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-13 07:52:27 +0000 |
| commit | b1ed7fac12fe51080c06e518a9fcaa21f0734744 (patch) | |
| tree | 62ec01511606af98540d5b78bb24b2b848f4064e /Python | |
| parent | 2a19074a9c58d491712139cd3607c10fddebbebc (diff) | |
| download | cpython-git-b1ed7fac12fe51080c06e518a9fcaa21f0734744.tar.gz | |
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 fe923ac387..27b481152a 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 e2bb8fcbbf..2124824f6c 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 77a25ea509..65480c823a 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; |
