[Python-checkins] r46244 - in python/trunk: Modules/cPickle.c Modules/gcmodule.c Modules/parsermodule.c Objects/classobject.c Objects/typeobject.c Objects/weakrefobject.c Python/ceval.c Python/import.c
georg.brandl
python-checkins at python.org
Thu May 25 21:15:34 CEST 2006
Author: georg.brandl
Date: Thu May 25 21:15:31 2006
New Revision: 46244
Modified:
python/trunk/Modules/cPickle.c
python/trunk/Modules/gcmodule.c
python/trunk/Modules/parsermodule.c
python/trunk/Objects/classobject.c
python/trunk/Objects/typeobject.c
python/trunk/Objects/weakrefobject.c
python/trunk/Python/ceval.c
python/trunk/Python/import.c
Log:
Replace PyObject_CallFunction calls with only object args
with PyObject_CallFunctionObjArgs, which is 30% faster.
Modified: python/trunk/Modules/cPickle.c
==============================================================================
--- python/trunk/Modules/cPickle.c (original)
+++ python/trunk/Modules/cPickle.c Thu May 25 21:15:31 2006
@@ -3073,8 +3073,8 @@
"pickles are not supported.");
return NULL;
}
- return PyObject_CallFunction(fc, "OO", py_module_name,
- py_global_name);
+ return PyObject_CallFunctionObjArgs(fc, py_module_name,
+ py_global_name, NULL);
}
module = PySys_GetObject("modules");
Modified: python/trunk/Modules/gcmodule.c
==============================================================================
--- python/trunk/Modules/gcmodule.c (original)
+++ python/trunk/Modules/gcmodule.c Thu May 25 21:15:31 2006
@@ -603,7 +603,7 @@
assert(callback != NULL);
/* copy-paste of weakrefobject.c's handle_callback() */
- temp = PyObject_CallFunction(callback, "O", wr);
+ temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
if (temp == NULL)
PyErr_WriteUnraisable(callback);
else
Modified: python/trunk/Modules/parsermodule.c
==============================================================================
--- python/trunk/Modules/parsermodule.c (original)
+++ python/trunk/Modules/parsermodule.c Thu May 25 21:15:31 2006
@@ -3267,8 +3267,8 @@
&& (pickler != NULL)) {
PyObject *res;
- res = PyObject_CallFunction(func, "OOO", &PyST_Type, pickler,
- pickle_constructor);
+ res = PyObject_CallFunctionObjArgs(func, &PyST_Type, pickler,
+ pickle_constructor, NULL);
Py_XDECREF(res);
}
Py_XDECREF(func);
Modified: python/trunk/Objects/classobject.c
==============================================================================
--- python/trunk/Objects/classobject.c (original)
+++ python/trunk/Objects/classobject.c Thu May 25 21:15:31 2006
@@ -81,12 +81,9 @@
if (!PyClass_Check(base)) {
if (PyCallable_Check(
(PyObject *) base->ob_type))
- return PyObject_CallFunction(
+ return PyObject_CallFunctionObjArgs(
(PyObject *) base->ob_type,
- "OOO",
- name,
- bases,
- dict);
+ name, bases, dict, NULL);
PyErr_SetString(PyExc_TypeError,
"PyClass_New: base must be a class");
return NULL;
Modified: python/trunk/Objects/typeobject.c
==============================================================================
--- python/trunk/Objects/typeobject.c (original)
+++ python/trunk/Objects/typeobject.c Thu May 25 21:15:31 2006
@@ -4641,10 +4641,10 @@
(void *)PyObject_GenericGetAttr))
res = PyObject_GenericGetAttr(self, name);
else
- res = PyObject_CallFunction(getattribute, "OO", self, name);
+ res = PyObject_CallFunctionObjArgs(getattribute, self, name, NULL);
if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_Clear();
- res = PyObject_CallFunction(getattr, "OO", self, name);
+ res = PyObject_CallFunctionObjArgs(getattr, self, name, NULL);
}
return res;
}
@@ -4781,7 +4781,7 @@
obj = Py_None;
if (type == NULL)
type = Py_None;
- return PyObject_CallFunction(get, "OOO", self, obj, type);
+ return PyObject_CallFunctionObjArgs(get, self, obj, type, NULL);
}
static int
@@ -5728,8 +5728,8 @@
if (su->ob_type != &PySuper_Type)
/* If su is an instance of a (strict) subclass of super,
call its type */
- return PyObject_CallFunction((PyObject *)su->ob_type,
- "OO", su->type, obj);
+ return PyObject_CallFunctionObjArgs((PyObject *)su->ob_type,
+ su->type, obj, NULL);
else {
/* Inline the common case */
PyTypeObject *obj_type = supercheck(su->type, obj);
Modified: python/trunk/Objects/weakrefobject.c
==============================================================================
--- python/trunk/Objects/weakrefobject.c (original)
+++ python/trunk/Objects/weakrefobject.c Thu May 25 21:15:31 2006
@@ -851,7 +851,7 @@
static void
handle_callback(PyWeakReference *ref, PyObject *callback)
{
- PyObject *cbresult = PyObject_CallFunction(callback, "O", ref);
+ PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL);
if (cbresult == NULL)
PyErr_WriteUnraisable(callback);
Modified: python/trunk/Python/ceval.c
==============================================================================
--- python/trunk/Python/ceval.c (original)
+++ python/trunk/Python/ceval.c Thu May 25 21:15:31 2006
@@ -4053,7 +4053,7 @@
metaclass = (PyObject *) &PyClass_Type;
Py_INCREF(metaclass);
}
- result = PyObject_CallFunction(metaclass, "OOO", name, bases, methods);
+ result = PyObject_CallFunctionObjArgs(metaclass, name, bases, methods, NULL);
Py_DECREF(metaclass);
if (result == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) {
/* A type error here likely means that the user passed
Modified: python/trunk/Python/import.c
==============================================================================
--- python/trunk/Python/import.c (original)
+++ python/trunk/Python/import.c Thu May 25 21:15:31 2006
@@ -1043,7 +1043,7 @@
PyObject *hook = PyList_GetItem(path_hooks, j);
if (hook == NULL)
return NULL;
- importer = PyObject_CallFunction(hook, "O", p);
+ importer = PyObject_CallFunctionObjArgs(hook, p, NULL);
if (importer != NULL)
break;
@@ -2499,8 +2499,8 @@
goto err;
/* Call the _import__ function with the proper argument list */
- r = PyObject_CallFunction(import, "OOOO",
- module_name, globals, globals, silly_list);
+ r = PyObject_CallFunctionObjArgs(import, module_name, globals,
+ globals, silly_list, NULL);
err:
Py_XDECREF(globals);
More information about the Python-checkins
mailing list