|
|
#ifndef Py_CPYTHON_ABSTRACTOBJECT_H |
|
|
# error "this header file must not be included directly" |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#ifdef PY_SSIZE_T_CLEAN |
|
|
# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyStack_AsDict( |
|
|
PyObject *const *values, |
|
|
PyObject *kwnames); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define _PY_FASTCALL_SMALL_STACK 5 |
|
|
|
|
|
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult( |
|
|
PyThreadState *tstate, |
|
|
PyObject *callable, |
|
|
PyObject *result, |
|
|
const char *where); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyObject_MakeTpCall( |
|
|
PyThreadState *tstate, |
|
|
PyObject *callable, |
|
|
PyObject *const *args, Py_ssize_t nargs, |
|
|
PyObject *keywords); |
|
|
|
|
|
#define PY_VECTORCALL_ARGUMENTS_OFFSET \ |
|
|
(_Py_STATIC_CAST(size_t, 1) << (8 * sizeof(size_t) - 1)) |
|
|
|
|
|
static inline Py_ssize_t |
|
|
PyVectorcall_NARGS(size_t n) |
|
|
{ |
|
|
return n & ~PY_VECTORCALL_ARGUMENTS_OFFSET; |
|
|
} |
|
|
|
|
|
PyAPI_FUNC(vectorcallfunc) PyVectorcall_Function(PyObject *callable); |
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyObject_Vectorcall( |
|
|
PyObject *callable, |
|
|
PyObject *const *args, |
|
|
size_t nargsf, |
|
|
PyObject *kwnames); |
|
|
|
|
|
|
|
|
#define _PyObject_Vectorcall PyObject_Vectorcall |
|
|
#define _PyObject_VectorcallMethod PyObject_VectorcallMethod |
|
|
#define _PyObject_FastCallDict PyObject_VectorcallDict |
|
|
#define _PyVectorcall_Function PyVectorcall_Function |
|
|
#define _PyObject_CallOneArg PyObject_CallOneArg |
|
|
#define _PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs |
|
|
#define _PyObject_CallMethodOneArg PyObject_CallMethodOneArg |
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyObject_VectorcallDict( |
|
|
PyObject *callable, |
|
|
PyObject *const *args, |
|
|
size_t nargsf, |
|
|
PyObject *kwargs); |
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict); |
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyObject_FastCall( |
|
|
PyObject *func, |
|
|
PyObject *const *args, |
|
|
Py_ssize_t nargs); |
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyObject_CallOneArg(PyObject *func, PyObject *arg); |
|
|
|
|
|
PyAPI_FUNC(PyObject *) PyObject_VectorcallMethod( |
|
|
PyObject *name, PyObject *const *args, |
|
|
size_t nargsf, PyObject *kwnames); |
|
|
|
|
|
static inline PyObject * |
|
|
PyObject_CallMethodNoArgs(PyObject *self, PyObject *name) |
|
|
{ |
|
|
size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET; |
|
|
return PyObject_VectorcallMethod(name, &self, nargsf, _Py_NULL); |
|
|
} |
|
|
|
|
|
static inline PyObject * |
|
|
PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg) |
|
|
{ |
|
|
PyObject *args[2] = {self, arg}; |
|
|
size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET; |
|
|
assert(arg != NULL); |
|
|
return PyObject_VectorcallMethod(name, args, nargsf, _Py_NULL); |
|
|
} |
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethod(PyObject *obj, |
|
|
PyObject *name, |
|
|
const char *format, ...); |
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, |
|
|
_Py_Identifier *name, |
|
|
const char *format, ...); |
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, |
|
|
_Py_Identifier *name, |
|
|
const char *format, |
|
|
...); |
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs( |
|
|
PyObject *obj, |
|
|
_Py_Identifier *name, |
|
|
...); |
|
|
|
|
|
static inline PyObject * |
|
|
_PyObject_VectorcallMethodId( |
|
|
_Py_Identifier *name, PyObject *const *args, |
|
|
size_t nargsf, PyObject *kwnames) |
|
|
{ |
|
|
PyObject *oname = _PyUnicode_FromId(name); |
|
|
if (!oname) { |
|
|
return _Py_NULL; |
|
|
} |
|
|
return PyObject_VectorcallMethod(oname, args, nargsf, kwnames); |
|
|
} |
|
|
|
|
|
static inline PyObject * |
|
|
_PyObject_CallMethodIdNoArgs(PyObject *self, _Py_Identifier *name) |
|
|
{ |
|
|
size_t nargsf = 1 | PY_VECTORCALL_ARGUMENTS_OFFSET; |
|
|
return _PyObject_VectorcallMethodId(name, &self, nargsf, _Py_NULL); |
|
|
} |
|
|
|
|
|
static inline PyObject * |
|
|
_PyObject_CallMethodIdOneArg(PyObject *self, _Py_Identifier *name, PyObject *arg) |
|
|
{ |
|
|
PyObject *args[2] = {self, arg}; |
|
|
size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET; |
|
|
assert(arg != NULL); |
|
|
return _PyObject_VectorcallMethodId(name, args, nargsf, _Py_NULL); |
|
|
} |
|
|
|
|
|
PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PySequence_ITEM(o, i)\ |
|
|
( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) |
|
|
|
|
|
#define PY_ITERSEARCH_COUNT 1 |
|
|
#define PY_ITERSEARCH_INDEX 2 |
|
|
#define PY_ITERSEARCH_CONTAINS 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, |
|
|
PyObject *obj, int operation); |
|
|
|
|
|
|
|
|
|
|
|
PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); |
|
|
|
|
|
PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); |
|
|
|
|
|
PyAPI_FUNC(char *const *) _PySequence_BytesToCharpArray(PyObject* self); |
|
|
|
|
|
PyAPI_FUNC(void) _Py_FreeCharPArray(char *const array[]); |
|
|
|
|
|
|
|
|
PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, |
|
|
const Py_ssize_t *shape); |
|
|
PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, |
|
|
const Py_ssize_t *shape); |
|
|
|
|
|
|
|
|
PyAPI_FUNC(int) _Py_convert_optional_to_ssize_t(PyObject *, void *); |
|
|
|
|
|
|
|
|
PyAPI_FUNC(PyObject *) _PyNumber_Index(PyObject *o); |
|
|
|