]> granicus.if.org Git - python/commitdiff
Handle ssize_t
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 6 Apr 2006 08:05:53 +0000 (08:05 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 6 Apr 2006 08:05:53 +0000 (08:05 +0000)
No need to INCREF then let PyString_ConcatAndDel() DECREF.  Just
use PyString_Concat().
Handle error condition if we can't concat.

Modules/_ctypes/_ctypes.c

index bd8bf3cbdd0c8cd167f09c1f0a53bf8929548f1b..0743ec9c2df0fa0c5a45007bcadc70b7cfdc7e33 100644 (file)
@@ -1271,7 +1271,7 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
        PyObject *name = PyTuple_GET_ITEM(args, 0);
        PyObject *swapped_args;
        static PyObject *suffix;
-       int i;
+       Py_ssize_t i;
 
        swapped_args = PyTuple_New(PyTuple_GET_SIZE(args));
        if (!swapped_args)
@@ -1284,8 +1284,9 @@ static PyObject *CreateSwappedType(PyTypeObject *type, PyObject *args, PyObject
                suffix = PyString_FromString("_be");
 #endif
 
-       Py_INCREF(suffix);
-       PyString_ConcatAndDel(&name, suffix);
+       PyString_Concat(&name, suffix);
+       if (name == NULL)
+               return NULL;
 
        PyTuple_SET_ITEM(swapped_args, 0, name);
        for (i=1; i<PyTuple_GET_SIZE(args); ++i) {