[Python-checkins] CVS: python/dist/src/Modules arraymodule.c,2.58,2.59

Tim Peters python-dev@python.org
Fri, 10 Nov 2000 11:04:22 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv21831/python/dist/src/modules

Modified Files:
	arraymodule.c 
Log Message:
Fix for SF bug 117402, crashes on str(array) and repr(array).  This was an
unfortunate consequence of somebody switching from PyArg_Parse to
PyArg_ParseTuple but without changing the argument from a NULL to a tuple.


Index: arraymodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v
retrieving revision 2.58
retrieving revision 2.59
diff -C2 -r2.58 -r2.59
*** arraymodule.c	2000/09/26 05:46:01	2.58
--- arraymodule.c	2000/11/10 19:04:19	2.59
***************
*** 1192,1196 ****
  	int ok = 0;
  	int i, len;
- 	PyObject *t_empty = PyTuple_New(0);
  	PyObject *v;
  	len = a->ob_size;
--- 1192,1195 ----
***************
*** 1200,1206 ****
  	}
  	if (a->ob_descr->typecode == 'c') {
  		fprintf(fp, "array('c', ");
  		v = array_tostring(a, t_empty);
! 		Py_DECREF(t_empty);;
  		ok = PyObject_Print(v, fp, 0);
  		Py_XDECREF(v);
--- 1199,1206 ----
  	}
  	if (a->ob_descr->typecode == 'c') {
+ 		PyObject *t_empty = PyTuple_New(0);
  		fprintf(fp, "array('c', ");
  		v = array_tostring(a, t_empty);
! 		Py_DECREF(t_empty);
  		ok = PyObject_Print(v, fp, 0);
  		Py_XDECREF(v);
***************
*** 1232,1238 ****
  	}
  	if (a->ob_descr->typecode == 'c') {
  		sprintf(buf, "array('c', ");
  		s = PyString_FromString(buf);
! 		v = array_tostring(a, (PyObject *)NULL);
  		t = PyObject_Repr(v);
  		Py_XDECREF(v);
--- 1232,1240 ----
  	}
  	if (a->ob_descr->typecode == 'c') {
+ 		PyObject *t_empty = PyTuple_New(0);
  		sprintf(buf, "array('c', ");
  		s = PyString_FromString(buf);
! 		v = array_tostring(a, t_empty);
! 		Py_DECREF(t_empty);
  		t = PyObject_Repr(v);
  		Py_XDECREF(v);