Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-114626: add PyCFunctionFast and PyCFunctionFastWithKeywords#114627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
25d0412b96c1e5746ebd678345d3178bbdc6717379File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -187,23 +187,23 @@ Implementing functions and methods | ||
| PyObject *kwargs); | ||
| .. c:type::PyCFunctionFast | ||
| Type of the functions used to implement Python callables in C | ||
| with signature :c:macro:`METH_FASTCALL`. | ||
| The function signature is:: | ||
| PyObject *PyCFunctionFast(PyObject *self, | ||
erlend-aasland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| PyObject *const *args, | ||
| Py_ssize_t nargs); | ||
| .. c:type::PyCFunctionFastWithKeywords | ||
| Type of the functions used to implement Python callables in C | ||
| with signature :ref:`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-METH_KEYWORDS>`. | ||
| The function signature is:: | ||
| PyObject *PyCFunctionFastWithKeywords(PyObject *self, | ||
| PyObject *const *args, | ||
| Py_ssize_t nargs, | ||
| PyObject *kwnames); | ||
| @@ -290,7 +290,7 @@ There are these calling conventions: | ||
| .. c:macro:: METH_FASTCALL | ||
| Fast calling convention supporting only positional arguments. | ||
| The methods have the type :c:type:`PyCFunctionFast`. | ||
| The first parameter is *self*, the second parameter is a C array | ||
| of :c:expr:`PyObject*` values indicating the arguments and the third | ||
| parameter is the number of arguments (the length of the array). | ||
| @@ -306,7 +306,7 @@ There are these calling conventions: | ||
| :c:expr:`METH_FASTCALL | METH_KEYWORDS` | ||
| Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, | ||
| with methods of type :c:type:`PyCFunctionFastWithKeywords`. | ||
| Keyword arguments are passed the same way as in the | ||
| :ref:`vectorcall protocol <vectorcall>`: | ||
| there is an additional fourth :c:expr:`PyObject*` parameter | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -17,15 +17,20 @@ 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 *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, | ||
| 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`. | ||
encukou marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| 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 | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.