[Python-checkins] CVS: python/dist/src/Python exceptions.c,1.22,1.22.2.1 ceval.c,2.230.2.3,2.230.2.4

Guido van Rossum gvanrossum@usw-pr-cvs1.sourceforge.net
2001年3月14日 08:17:29 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv28608/Python
Modified Files:
 Tag: iter-branch
	exceptions.c ceval.c 
Log Message:
Switch from IndexError to StopIteration to end the sequence.
Index: exceptions.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/exceptions.c,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -C2 -r1.22 -r1.22.2.1
*** exceptions.c	2001年02月28日 21:52:10	1.22
--- exceptions.c	2001年03月14日 16:17:27	1.22.2.1
***************
*** 53,56 ****
--- 53,57 ----
 |\n\
 +-- SystemExit\n\
+ +-- StopIteration\n\
 +-- StandardError\n\
 | |\n\
***************
*** 370,373 ****
--- 371,377 ----
 TypeError__doc__[] = "Inappropriate argument type.";
 
+ static char
+ StopIteration__doc__[] = "Signal the end from iterator.next().";
+ 
 
 
***************
*** 925,928 ****
--- 929,933 ----
 
 PyObject *PyExc_Exception;
+ PyObject *PyExc_StopIteration;
 PyObject *PyExc_StandardError;
 PyObject *PyExc_ArithmeticError;
***************
*** 986,989 ****
--- 991,996 ----
 */
 {"Exception", &PyExc_Exception},
+ {"StopIteration", &PyExc_StopIteration, &PyExc_Exception,
+ StopIteration__doc__},
 {"StandardError", &PyExc_StandardError, &PyExc_Exception,
 StandardError__doc__},
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.230.2.3
retrieving revision 2.230.2.4
diff -C2 -r2.230.2.3 -r2.230.2.4
*** ceval.c	2001年03月13日 13:53:57	2.230.2.3
--- ceval.c	2001年03月14日 16:17:27	2.230.2.4
***************
*** 1850,1854 ****
 			x = PyObject_CallObject(v, NULL);
 			if (x == NULL) {
! 				if (PyErr_ExceptionMatches(PyExc_IndexError)) {
 					PyErr_Clear();
 					x = v = POP();
--- 1850,1856 ----
 			x = PyObject_CallObject(v, NULL);
 			if (x == NULL) {
! 				if (PyErr_ExceptionMatches(
! 					PyExc_StopIteration))
! 				{
 					PyErr_Clear();
 					x = v = POP();

AltStyle によって変換されたページ (->オリジナル) /