mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
gh-114626: add PyCFunctionFast and PyCFunctionFastWithKeywords (GH-114627)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
parent
32f8ab1ab6
commit
9e3729bbd7
10 changed files with 57 additions and 41 deletions
|
@ -17,15 +17,22 @@ PyAPI_DATA(PyTypeObject) PyCFunction_Type;
|
|||
#define PyCFunction_Check(op) PyObject_TypeCheck((op), &PyCFunction_Type)
|
||||
|
||||
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
|
||||
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t);
|
||||
typedef PyObject *(*PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t);
|
||||
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
|
||||
PyObject *);
|
||||
typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *,
|
||||
PyObject *const *, Py_ssize_t,
|
||||
PyObject *);
|
||||
typedef PyObject *(*PyCFunctionFastWithKeywords) (PyObject *,
|
||||
PyObject *const *, Py_ssize_t,
|
||||
PyObject *);
|
||||
typedef PyObject *(*PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *,
|
||||
size_t, PyObject *);
|
||||
|
||||
// For backwards compatibility. `METH_FASTCALL` was added to the stable API in
|
||||
// 3.10 alongside `_PyCFunctionFastWithKeywords` and `_PyCFunctionFast`.
|
||||
// Note that the underscore-prefixed names were documented in public docs;
|
||||
// people may be using them.
|
||||
typedef PyCFunctionFast _PyCFunctionFast;
|
||||
typedef PyCFunctionWithKeywords _PyCFunctionWithKeywords;
|
||||
|
||||
// Cast an function to the PyCFunction type to use it with PyMethodDef.
|
||||
//
|
||||
// This macro can be used to prevent compiler warnings if the first parameter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue