[Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.12,1.13

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Fri, 02 May 2003 22:59:50 -0700


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

Modified Files:
	itertoolsmodule.c 
Log Message:
* Added a substantial number of edge case and argument tests for
  the itertoolsmodule.
* Taught itertools.repeat(obj, n) to treat negative repeat counts as
  zero.  This behavior matches that for sequences and prevents 
  infinite loops.


Index: itertoolsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** itertoolsmodule.c	2 May 2003 19:44:20 -0000	1.12
--- itertoolsmodule.c	3 May 2003 05:59:47 -0000	1.13
***************
*** 1692,1695 ****
--- 1692,1698 ----
  		return NULL;
  
+ 	if (PyTuple_Size(args) == 2 && cnt < 0)
+ 		cnt = 0;
+ 
  	ro = (repeatobject *)type->tp_alloc(type, 0);
  	if (ro == NULL)