File MySQL-python-Py_ssize.patch of Package python-MySQL-python

diff -ruN a/_mysql.c b/_mysql.c
--- a/_mysql.c	2014-01-02 13:52:50.000000000 +0100
+++ b/_mysql.c	2014-01-08 12:08:40.476703176 +0100
@@ -264,7 +264,7 @@
 	PyObject *kwargs) {
 	static char *kwlist[] = {"args", "groups", NULL};
 	char **cmd_args_c=NULL, **groups_c=NULL, *s;
-	int cmd_argc=0, i, groupc;
+	Py_ssize_t cmd_argc=0, i, groupc;
 	PyObject *cmd_args=NULL, *groups=NULL, *ret=NULL, *item;
 
 	if (_mysql_server_init_done) {
@@ -289,6 +289,10 @@
 			PyErr_SetString(PyExc_TypeError,
 					"args could not be sized");
 			goto finish;
+                } else if (cmd_argc > INT_MAX) {
+                        PyErr_SetString(PyExc_ValueError,
+                                        "more than INT_MAX args, this is unsupported");
+ 			goto finish;
 		}
 		cmd_args_c = (char **) PyMem_Malloc(cmd_argc*sizeof(char *));
 		for (i=0; i< cmd_argc; i++) {
@@ -467,7 +471,7 @@
 			Py_INCREF(Py_None);
 		}
 		else if (PySequence_Check(fun)) {
-			int j, n2=PySequence_Size(fun);
+			Py_ssize_t j, n2=PySequence_Size(fun);
 			PyObject *fun2=NULL;
 			for (j=0; j<n2; j++) {
 				PyObject *t = PySequence_GetItem(fun, j);
@@ -1263,7 +1267,7 @@
 	PyObject *args)
 {
 	PyObject *o=NULL, *d=NULL, *r=NULL, *item, *quoted; 
-	int i, n;
+	Py_ssize_t i, n;
 	if (!PyArg_ParseTuple(args, "OO:escape_sequence", &o, &d))
 		goto error;
 	if (!PyMapping_Check(d)) {
openSUSE Build Service is sponsored by