[Python-checkins] CVS: python/dist/src/Python ceval.c,2.244,2.245

Jeremy Hylton jhylton@users.sourceforge.net
Tue, 29 May 2001 09:23:28 -0700


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

Modified Files:
	ceval.c 
Log Message:
Fix bug reported by Tim Peters on python-dev: 

Keyword arguments passed to builtin functions that don't take them are
ignored.

>>> {}.clear(x=2)
>>>

instead of 

>>> {}.clear(x=2)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: clear() takes no keyword arguments



Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.244
retrieving revision 2.245
diff -C2 -r2.244 -r2.245
*** ceval.c	2001/05/18 20:53:14	2.244
--- ceval.c	2001/05/29 16:23:26	2.245
***************
*** 1971,1986 ****
  		    if (PyCFunction_Check(func)) {
  			    int flags = PyCFunction_GET_FLAGS(func);
! 			    if (flags == METH_VARARGS) {
  				    PyObject *callargs;
  				    callargs = load_args(&stack_pointer, na);
  				    x = call_cfunction(func, callargs, NULL);
  				    Py_XDECREF(callargs); 
! 			    } else if (flags == 0) {
  				    x = fast_cfunction(func,
  						       &stack_pointer, na);
- 			    } else {
- 				    x = do_call(func, &stack_pointer,
- 						na, nk);
- 			    }
  		    } else {
  			    if (PyMethod_Check(func)
--- 1971,1985 ----
  		    if (PyCFunction_Check(func)) {
  			    int flags = PyCFunction_GET_FLAGS(func);
! 			    if (flags > 1 || nk != 0) 
! 				    x = do_call(func, &stack_pointer,
! 						na, nk);
! 			    else if (flags == METH_VARARGS) {
  				    PyObject *callargs;
  				    callargs = load_args(&stack_pointer, na);
  				    x = call_cfunction(func, callargs, NULL);
  				    Py_XDECREF(callargs); 
! 			    } else if (flags == 0) 
  				    x = fast_cfunction(func,
  						       &stack_pointer, na);
  		    } else {
  			    if (PyMethod_Check(func)