[Python-checkins] r43692 - python/trunk/Modules/_ctypes/_ctypes.c

neal.norwitz python-checkins at python.org
Thu Apr 6 10:05:54 CEST 2006


Author: neal.norwitz
Date: Thu Apr  6 10:05:53 2006
New Revision: 43692

Modified:
   python/trunk/Modules/_ctypes/_ctypes.c
Log:
Handle ssize_t
No need to INCREF then let PyString_ConcatAndDel() DECREF.  Just
use PyString_Concat().
Handle error condition if we can't concat.


Modified: python/trunk/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/trunk/Modules/_ctypes/_ctypes.c	(original)
+++ python/trunk/Modules/_ctypes/_ctypes.c	Thu Apr  6 10:05:53 2006
@@ -1271,7 +1271,7 @@
 	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 @@
 		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) {


More information about the Python-checkins mailing list