◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
6 changes: 6 additions & 0 deletions Include/ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ extern "C" {

/* Interface to random parts in ceval.c */

PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
PyObject *callable,
PyObject *args,
Expand Down
57 changes: 24 additions & 33 deletions Objects/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,25 +939,20 @@ PyObject_CallFunction(PyObject *callable, const char *format, ...)
}


PyObject *
PyEval_CallFunction(PyObject *callable, const char *format, ...)
{
va_list vargs;
PyObject *args;
PyObject *res;

va_start(vargs, format);

args = Py_VaBuildValue(format, vargs);
va_end(vargs);

if (args == NULL)
return NULL;

res = PyEval_CallObject(callable, args);
Py_DECREF(args);

return res;
}


Expand Down Expand Up @@ -1014,33 +1009,29 @@ PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
}


PyObject *
PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
{
va_list vargs;
PyObject *meth;
PyObject *args;
PyObject *res;

meth = PyObject_GetAttrString(obj, name);
if (meth == NULL)
return NULL;

va_start(vargs, format);

args = Py_VaBuildValue(format, vargs);
va_end(vargs);

if (args == NULL) {
Py_DECREF(meth);
return NULL;
}

res = PyEval_CallObject(meth, args);
Py_DECREF(meth);
Py_DECREF(args);

return res;
}


Expand Down
Toggle all file notes Toggle all file annotations