summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-09-10 00:40:22 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-09-10 00:40:22 (GMT)
commita9efb2f56eb6bcb97cebfadf1e778b4cb979357f (patch)
treeab942c23afa123480faca8207c99c53e804eceed /Include
parent78601a38c22ba1f09104e2562a10a94cbd36f5f0 (diff)
downloadcpython-a9efb2f56eb6bcb97cebfadf1e778b4cb979357f.zip
cpython-a9efb2f56eb6bcb97cebfadf1e778b4cb979357f.tar.gz
cpython-a9efb2f56eb6bcb97cebfadf1e778b4cb979357f.tar.bz2
Add METH_FASTCALL calling convention
Issue #27810: Add a new calling convention for C functions: PyObject* func(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); Where args is a C array of positional arguments followed by values of keyword arguments. nargs is the number of positional arguments, kwnames are keys of keyword arguments. kwnames can be NULL.
Diffstat (limited to 'Include')
-rw-r--r--Include/abstract.h16
-rw-r--r--Include/methodobject.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/Include/abstract.h b/Include/abstract.h
index 3f398da..3e630b1 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -277,6 +277,22 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
PyObject *kwnames,
PyObject *func);
+ /* Convert (args, nargs, kwargs) into a (stack, nargs, kwnames).
+
+ Return a new stack which should be released by PyMem_Free(), or return
+ args unchanged if kwargs is NULL or an empty dictionary.
+
+ The stack uses borrowed references.
+
+ The type of keyword keys is not checked, these checks should be done
+ later (ex: _PyArg_ParseStack). */
+ PyAPI_FUNC(PyObject **) _PyStack_UnpackDict(
+ PyObject **args,
+ Py_ssize_t nargs,
+ PyObject *kwargs,
+ PyObject **kwnames,
+ PyObject *func);
+
/* Call the callable object func with the "fast call" calling convention:
args is a C array for positional arguments (nargs is the number of
positional arguments), kwargs is a dictionary for keyword arguments.
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 1f4f06c..9dba58f 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -16,6 +16,8 @@ PyAPI_DATA(PyTypeObject) PyCFunction_Type;
#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type)
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
+typedef PyObject *(*_PyCFunctionFast) (PyObject *self, PyObject **args,
+ Py_ssize_t nargs, PyObject *kwnames);
typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
PyObject *);
typedef PyObject *(*PyNoArgsFunction)(PyObject *);
@@ -83,6 +85,8 @@ PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
#define METH_COEXIST 0x0040
+#define METH_FASTCALL 0x0080
+
#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD