[Python-checkins] python/dist/src/Objects listobject.c,2.147,2.148

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 14 Apr 2003 13:58:48 -0700


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

Modified Files:
	listobject.c 
Log Message:
- list.insert(i, x) now interprets negative i as it would be
  interpreted by slicing, so negative values count from the end of the
  list.  This was the only place where such an interpretation was not
  placed on a list index.


Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.147
retrieving revision 2.148
diff -C2 -d -r2.147 -r2.148
*** listobject.c	17 Mar 2003 19:46:10 -0000	2.147
--- listobject.c	14 Apr 2003 20:58:13 -0000	2.148
***************
*** 160,165 ****
  		return -1;
  	}
! 	if (where < 0)
! 		where = 0;
  	if (where > self->ob_size)
  		where = self->ob_size;
--- 160,168 ----
  		return -1;
  	}
! 	if (where < 0) {
! 		where += self->ob_size;
! 		if (where < 0)
! 			where = 0;
! 	}
  	if (where > self->ob_size)
  		where = self->ob_size;