mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Python 3.7 METH_FASTCALL backport (#406)
This commit is contained in:
parent
fec396037a
commit
83b743cf96
103 changed files with 2949 additions and 3356 deletions
52
third_party/python/Python/modsupport.c
vendored
52
third_party/python/Python/modsupport.c
vendored
|
@ -600,58 +600,6 @@ va_build_stack(PyObject **small_stack, Py_ssize_t small_stack_len,
|
|||
return stack;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int
|
||||
PyModule_AddObject(PyObject *m, const char *name, PyObject *o)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue