]> granicus.if.org Git - python/commitdiff
Replace INT_MAX with PY_SSIZE_T_MAX.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 13 Apr 2006 07:52:27 +0000 (07:52 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 13 Apr 2006 07:52:27 +0000 (07:52 +0000)
Modules/functionalmodule.c
Objects/listobject.c
Python/bltinmodule.c
Python/codecs.c
Python/modsupport.c

index 4b2e9b4d642213d9d350571b8563a872f15ecc89..38ef43a71931c7dbc35849cf49c55b2f504e3ff4 100644 (file)
@@ -48,7 +48,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
 
        pto->fn = func;
        Py_INCREF(func);
-       pto->args = PyTuple_GetSlice(args, 1, INT_MAX);
+       pto->args = PyTuple_GetSlice(args, 1, PY_SSIZE_T_MAX);
        if (pto->args == NULL) {
                pto->kw = NULL;
                Py_DECREF(pto);
index a66371fe7c30f2074a899e87c6c364cd4ef8ed7d..1debd23791b2fdc08e0a4c1086128dd538f1cb87 100644 (file)
@@ -181,7 +181,7 @@ ins1(PyListObject *self, Py_ssize_t where, PyObject *v)
                PyErr_BadInternalCall();
                return -1;
        }
-       if (n == INT_MAX) {
+       if (n == PY_SSIZE_T_MAX) {
                PyErr_SetString(PyExc_OverflowError,
                        "cannot add more objects to list");
                return -1;
@@ -221,7 +221,7 @@ app1(PyListObject *self, PyObject *v)
        Py_ssize_t n = PyList_GET_SIZE(self);
 
        assert (v != NULL);
-       if (n == INT_MAX) {
+       if (n == PY_SSIZE_T_MAX) {
                PyErr_SetString(PyExc_OverflowError,
                        "cannot add more objects to list");
                return -1;
index fe923ac387f87f68c7baa21d628e93c19d7cd3d8..27b481152ab3eaec250059b44a62b0a199a8607e 100644 (file)
@@ -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);
index e2bb8fcbbfb1d4ad621423dfff5547a0364a4eb5..2124824f6c1733b38f911501dcf44d7c6ff656d2 100644 (file)
@@ -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);
index 77a25ea509829d6420a8946f38aa52a26ba81f90..65480c823a52f7d095bf47037d43c432b5a4edd7 100644 (file)
@@ -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;