[Python-checkins] CVS: python/dist/src/Objects abstract.c,2.78,2.79

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 14 Sep 2001 09:47:52 -0700


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

Modified Files:
	abstract.c 
Log Message:
PyObject_CallObject(): this may as well call PyEval_CallObject()
directly, as the only thing done here (replace NULL args with an empty
tuple) is also done there.

XXX Maybe we should take one step further and equate the two at the
macro level?  That's harder though because PyEval_Call* is declared in
a header that's not included standard.  But it is silly that
PyObject_CallObject calls PyEval_CallObject which calls back to
PyObject_Call.  Maybe PyEval_CallObject should be moved into this file
instead?  All I know is that there are too many call APIs!  The
differences between PyObject_Call and PyEval_CallObjectWithKeywords is
that the latter allows args to be NULL, and does explicit type checks
for args and kwds.


Index: abstract.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v
retrieving revision 2.78
retrieving revision 2.79
diff -C2 -d -r2.78 -r2.79
*** abstract.c	2001/09/10 23:53:53	2.78
--- abstract.c	2001/09/14 16:47:50	2.79
***************
*** 1616,1635 ****
  PyObject_CallObject(PyObject *o, PyObject *a)
  {
! 	PyObject *r;
! 	PyObject *args = a;
! 
! 	if (args == NULL) {
! 		args = PyTuple_New(0);
! 		if (args == NULL)
! 			return NULL;
! 	}
! 
! 	r = PyEval_CallObject(o, args);
! 
! 	if (args != a) {
! 		Py_DECREF(args);
! 	}
! 
! 	return r;
  }
  
--- 1616,1620 ----
  PyObject_CallObject(PyObject *o, PyObject *a)
  {
! 	return PyEval_CallObjectWithKeywords(o, a, NULL);
  }