mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Replace PyObject_CallFunction calls with only object args
with PyObject_CallFunctionObjArgs, which is 30% faster.
This commit is contained in:
parent
3b0cae9cc0
commit
684fd0c8ec
8 changed files with 17 additions and 20 deletions
|
@ -4053,7 +4053,7 @@ build_class(PyObject *methods, PyObject *bases, PyObject *name)
|
|||
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
|
||||
|
|
|
@ -1043,7 +1043,7 @@ get_path_importer(PyObject *path_importer_cache, PyObject *path_hooks,
|
|||
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 @@ PyImport_Import(PyObject *module_name)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue