[Python-checkins] CVS: python/dist/src/Python getargs.c,2.73,2.74

Tim Peters tim_one@users.sourceforge.net
Fri, 26 Oct 2001 21:33:43 -0700


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

Modified Files:
	getargs.c 
Log Message:
vgetargskeywords:
+ Removed now-redundant tuple typecheck.
+ Renamed "tplen" local to "argslen" (it's the length of the "args"
  argument; I suppose "tp" was for "Tim Peters should rename me
  someday <wink>).


Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.73
retrieving revision 2.74
diff -C2 -d -r2.73 -r2.74
*** getargs.c	2001/10/27 04:26:57	2.73
--- getargs.c	2001/10/27 04:33:41	2.74
***************
*** 1033,1037 ****
  	int min, max;
  	char *formatsave = format;
! 	int i, len, tplen, kwlen;
  	char *msg, *ks, **p;
  	int nkwds, pos, match, converted;
--- 1033,1037 ----
  	int min, max;
  	char *formatsave = format;
! 	int i, len, argslen, kwlen;
  	char *msg, *ks, **p;
  	int nkwds, pos, match, converted;
***************
*** 1079,1089 ****
  	format = formatsave;
  
! 	if (!PyTuple_Check(args)) {
! 		PyErr_SetString(PyExc_SystemError,
! 		    "new style getargs format but argument is not a tuple");
! 		return 0;
! 	}	
! 
! 	tplen = PyTuple_GET_SIZE(args);
  
  	/* do a cursory check of the keywords just to see how many we got */
--- 1079,1083 ----
  	format = formatsave;
  
! 	argslen = PyTuple_GET_SIZE(args);
  
  	/* do a cursory check of the keywords just to see how many we got */
***************
*** 1105,1109 ****
  
  	if (keywords) {
! 		for (i = 0; i < tplen; i++) {
  			char *thiskw = kwlist[i];
  			if (thiskw == NULL)
--- 1099,1103 ----
  
  	if (keywords) {
! 		for (i = 0; i < argslen; i++) {
  			char *thiskw = kwlist[i];
  			if (thiskw == NULL)
***************
*** 1130,1136 ****
  	   arguments */
  	
! 	len = tplen;
! 	if (keywords && tplen < min) {
! 		for (i = tplen; i < min; i++) {
  		  if (PyMapping_HasKeyString(keywords, kwlist[i])) {
  				len++;
--- 1124,1130 ----
  	   arguments */
  	
! 	len = argslen;
! 	if (keywords && argslen < min) {
! 		for (i = argslen; i < min; i++) {
  		  if (PyMapping_HasKeyString(keywords, kwlist[i])) {
  				len++;
***************
*** 1162,1166 ****
  	}
  	
! 	for (i = 0; i < tplen; i++) {
  		if (*format == '|')
  			format++;
--- 1156,1160 ----
  	}
  	
! 	for (i = 0; i < argslen; i++) {
  		if (*format == '|')
  			format++;
***************
*** 1175,1179 ****
  	/* handle no keyword parameters in call  */	
  	   	   
! 	if (!keywords) return 1; 
  		
  	/* make sure the number of keywords in the keyword list matches the 
--- 1169,1174 ----
  	/* handle no keyword parameters in call  */	
  	   	   
! 	if (!keywords)
! 		return 1; 
  		
  	/* make sure the number of keywords in the keyword list matches the 
***************
*** 1197,1201 ****
  	
  	converted = 0;
! 	for (i = tplen; i < nkwds; i++) {
  		PyObject *item;
  		if (*format == '|')
--- 1192,1196 ----
  	
  	converted = 0;
! 	for (i = argslen; i < nkwds; i++) {
  		PyObject *item;
  		if (*format == '|')