[Python-checkins] CVS: python/dist/src/Python ceval.c,2.298,2.299

Tim Peters tim_one@users.sourceforge.net
2001年12月16日 11:44:24 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv27122/python/Python
Modified Files:
	ceval.c 
Log Message:
_PyEval_SliceIndex(): explain why a NULL argument is allowed (thanks
to Guido for the revelation).
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.298
retrieving revision 2.299
diff -C2 -d -r2.298 -r2.299
*** ceval.c	2001年12月16日 19:11:44	2.298
--- ceval.c	2001年12月16日 19:44:20	2.299
***************
*** 3333,3344 ****
 boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
 */
! /* XXX If v is NULL, this goes out of its way to indicate success(!), but
! XXX doesn't store into *pi. Why isn't that an error, or at least v!=NULL
! XXX an asserted precondition?
 */
 int
 _PyEval_SliceIndex(PyObject *v, int *pi)
 {
! 	if (v != NULL) { /* XXX why isn't this assert(v != NULL()? */
 		long x;
 		if (PyInt_Check(v)) {
--- 3333,3344 ----
 boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
 */
! /* Note: If v is NULL, return success without storing into *pi. This
! is because_PyEval_SliceIndex() is called by apply_slice(), which can be
! called by the SLICE opcode with v and/or w equal to NULL.
 */
 int
 _PyEval_SliceIndex(PyObject *v, int *pi)
 {
! 	if (v != NULL) {
 		long x;
 		if (PyInt_Check(v)) {

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