[Python-checkins] python/dist/src/Objects abstract.c, 2.132, 2.132.2.1

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Dec 17 15:44:49 CET 2004


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19114/Objects

Modified Files:
      Tag: release24-maint
	abstract.c 
Log Message:
Backport fixes for bugs #1086555 and #1085744.

Index: abstract.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v
retrieving revision 2.132
retrieving revision 2.132.2.1
diff -u -d -r2.132 -r2.132.2.1
--- abstract.c	19 Sep 2004 06:00:15 -0000	2.132
+++ abstract.c	17 Dec 2004 14:44:45 -0000	2.132.2.1
@@ -1427,10 +1427,15 @@
 			break;
 		}
 		if (j >= n) {
-			if (n < 500)
-				n += 10;
-			else
-				n += 100;
+			int oldn = n;
+			n += 10;
+			n += n >> 2;
+			if (n < oldn) {
+				/* Check for overflow */
+				PyErr_NoMemory();
+				Py_DECREF(item);
+				goto Fail; 
+			}
 			if (_PyTuple_Resize(&result, n) != 0) {
 				Py_DECREF(item);
 				goto Fail;



More information about the Python-checkins mailing list