cpython: a1a29d20f52d (original) (raw)

--- a/Include/abstract.h +++ b/Include/abstract.h @@ -267,10 +267,26 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx PyObject *args, PyObject *kw); #ifndef Py_LIMITED_API

+

+

+

+ PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char where); -#endif +#endif / Py_LIMITED_API / / Call a callable Python object, callable_object, with

--- a/Include/funcobject.h +++ b/Include/funcobject.h @@ -58,6 +58,13 @@ PyAPI_FUNC(int) PyFunction_SetClosure(Py PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *); PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyFunction_FastCall(

+#endif + /* Macros for direct access to these values. Type checks are not done, so use with care. */ #define PyFunction_GET_CODE(func) [](#l2.16)

--- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -37,6 +37,12 @@ PyAPI_FUNC(int) PyCFunction_GetFlags(PyO #endif PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyCFunction_FastCall(PyObject *func,

+#endif + struct PyMethodDef { const char ml_name; / The name of the built-in function/method / PyCFunction ml_meth; / The C function that implements it */

--- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2193,6 +2193,82 @@ PyObject_Call(PyObject *func, PyObject return _Py_CheckFunctionResult(func, result, NULL); } +PyObject +_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs) +{

+

+

+

+} + +PyObject * +_PyObject_FastCall(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) +{

+

+

+

+

+

+

+

+

+ +exit:

+

+} + static PyObject* call_function_tail(PyObject *callable, PyObject *args) {

--- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -145,6 +145,99 @@ PyCFunction_Call(PyObject *func, PyObjec return _Py_CheckFunctionResult(func, res, NULL); } +PyObject * +_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, int nargs,

+{

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+} + /* Methods (the standard built-in methods, that is) */ static void

--- a/Python/ceval.c +++ b/Python/ceval.c @@ -113,7 +113,7 @@ static PyObject * call_function(PyObject #else static PyObject * call_function(PyObject ***, int); #endif -static PyObject * fast_function(PyObject *, PyObject ***, int, int, int); +static PyObject * fast_function(PyObject *, PyObject **, int, int, int); static PyObject * do_call(PyObject *, PyObject ***, int, int); static PyObject * ext_do_call(PyObject *, PyObject ***, int, int, int); static PyObject * update_keyword_args(PyObject *, int, PyObject ***, @@ -3779,6 +3779,7 @@ too_many_positional(PyCodeObject co, in Py_DECREF(kwonly_sig); } + / This is gonna seem real weird, but if you put some other code between PyEval_EvalFrame() and PyEval_EvalCodeEx() you will need to adjust the test in the if statements in Misc/gdbinit (pystack and pystackv). */ @@ -4068,8 +4069,10 @@ PyEval_EvalCodeEx(PyObject *_co, PyObjec PyObject **defs, int defcount, PyObject *kwdefs, PyObject *closure) { return _PyEval_EvalCodeWithName(_co, globals, locals,

} @@ -4757,10 +4760,12 @@ call_function(PyObject ***pp_stack, int } else Py_INCREF(func); READ_TIMESTAMP(*pintr0);

@@ -4790,62 +4795,124 @@ call_function(PyObject ***pp_stack, int done before evaluating the frame. / +static PyObject +_PyFunction_FastCallNoKw(PyObject **args, Py_ssize_t na,

+{

+

+

+

+

+

+} + static PyObject * -fast_function(PyObject *func, PyObject ***pp_stack, int n, int na, int nk) +fast_function(PyObject *func, PyObject **stack, int n, int na, int nk) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func);

PCALL(PCALL_FUNCTION); PCALL(PCALL_FAST_FUNCTION);

-

-

-

+

+ if (argdefs != NULL) { d = &PyTuple_GET_ITEM(argdefs, 0); nd = Py_SIZE(argdefs); }

+} + +PyObject * +_PyFunction_FastCall(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) +{

+

+

+

+

+

} static PyObject *