[Python-checkins] python/dist/src/Python import.c,2.203,2.204

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 30 May 2002 10:33:10 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv1513

Modified Files:
	import.c 
Log Message:
imp_load_module(): correct and comment the sense of the test for '+'
in the mode (it's forbidden).


Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.203
retrieving revision 2.204
diff -C2 -d -r2.203 -r2.204
*** import.c	30 May 2002 17:15:25 -0000	2.203
--- import.c	30 May 2002 17:33:07 -0000	2.204
***************
*** 2409,2417 ****
  			      &suffix, &mode, &type))
  		return NULL;
! 	if (*mode &&
! 	    !(*mode == 'r' || *mode == 'U' || strchr(mode, '+'))) {
  			PyErr_Format(PyExc_ValueError,
  				     "invalid file open mode %.200s", mode);
  			return NULL;
  	}
  	if (fob == Py_None)
--- 2409,2422 ----
  			      &suffix, &mode, &type))
  		return NULL;
! 	if (*mode) {
! 		/* Mode must start with 'r' or 'U' and must not contain '+'.
! 		   Implicit in this test is the assumption that the mode
! 		   may contain other modifiers like 'b' or 't'. */
! 
! 		if (!(*mode == 'r' || *mode == 'U') || strchr(mode, '+')) {
  			PyErr_Format(PyExc_ValueError,
  				     "invalid file open mode %.200s", mode);
  			return NULL;
+ 		}
  	}
  	if (fob == Py_None)