[Python-checkins] python/dist/src/Objects listobject.c,2.150,2.151

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 03 May 2003 03:53:10 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv20734/Objects

Modified Files:
	listobject.c 
Log Message:
Patch #708604: Check more function results. Will backport to 2.2.


Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.150
retrieving revision 2.151
diff -C2 -d -r2.150 -r2.151
*** listobject.c	24 Apr 2003 20:59:50 -0000	2.150
--- listobject.c	3 May 2003 10:53:08 -0000	2.151
***************
*** 474,477 ****
--- 474,479 ----
  			int ret;
  			v = list_slice(b, 0, n);
+ 			if (v == NULL)
+ 				return -1;
  			ret = list_ass_slice(a, ilow, ihigh, v);
  			Py_DECREF(v);
***************
*** 489,494 ****
  	item = a->ob_item;
  	d = n - (ihigh-ilow);
! 	if (ihigh > ilow)
  		p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow));
  	else
  		p = recycle = NULL;
--- 491,501 ----
  	item = a->ob_item;
  	d = n - (ihigh-ilow);
! 	if (ihigh > ilow) {
  		p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow));
+ 		if (recycle == NULL) {
+ 			PyErr_NoMemory();
+ 			return -1;
+ 		}
+ 	}
  	else
  		p = recycle = NULL;