diff --git a/Include/Python.h b/Include/Python.h
index 1feb1531cc94f0..6a1ca3b04baecb 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -91,6 +91,7 @@
#include "odictobject.h"
#include "enumobject.h"
#include "setobject.h"
+#include "call.h"
#include "methodobject.h"
#include "moduleobject.h"
#include "funcobject.h"
diff --git a/Include/abstract.h b/Include/abstract.h
index 85550a34ca2686..972ea32c092c55 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -135,236 +135,6 @@ extern "C" {
This function always succeeds. */
-#ifdef PY_SSIZE_T_CLEAN
-# define PyObject_CallFunction _PyObject_CallFunction_SizeT
-# define PyObject_CallMethod _PyObject_CallMethod_SizeT
-# ifndef Py_LIMITED_API
-# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
-# endif /* !Py_LIMITED_API */
-#endif
-
-
-/* Call a callable Python object 'callable' with arguments given by the
- tuple 'args' and keywords arguments given by the dictionary 'kwargs'.
-
- 'args' must not be *NULL*, use an empty tuple if no arguments are
- needed. If no named arguments are needed, 'kwargs' can be NULL.
-
- This is the equivalent of the Python expression:
- callable(*args, **kwargs). */
-PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable,
- PyObject *args, PyObject *kwargs);
-
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject*) _PyStack_AsTuple(
- PyObject *const *stack,
- Py_ssize_t nargs);
-
-PyAPI_FUNC(PyObject*) _PyStack_AsTupleSlice(
- PyObject *const *stack,
- Py_ssize_t nargs,
- Py_ssize_t start,
- Py_ssize_t end);
-
-/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple)
- format to a Python dictionary ("kwargs" dict).
-
- The type of kwnames keys is not checked. The final function getting
- arguments is responsible to check if all keys are strings, for example using
- PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments().
-
- Duplicate keys are merged using the last value. If duplicate keys must raise
- an exception, the caller is responsible to implement an explicit keys on
- kwnames. */
-PyAPI_FUNC(PyObject *) _PyStack_AsDict(
- PyObject *const *values,
- PyObject *kwnames);
-
-/* Convert (args, nargs, kwargs: dict) into a (stack, nargs, kwnames: tuple).
-
- Return 0 on success, raise an exception and return -1 on error.
-
- Write the new stack into *p_stack. If *p_stack is differen than args, it
- must be released by PyMem_Free().
-
- The stack uses borrowed references.
-
- The type of keyword keys is not checked, these checks should be done
- later (ex: _PyArg_ParseStackAndKeywords). */
-PyAPI_FUNC(int) _PyStack_UnpackDict(
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwargs,
- PyObject *const **p_stack,
- PyObject **p_kwnames);
-
-/* Suggested size (number of positional arguments) for arrays of PyObject*
- allocated on a C stack to avoid allocating memory on the heap memory. Such
- array is used to pass positional arguments to call functions of the
- _PyObject_FastCall() family.
-
- The size is chosen to not abuse the C stack and so limit the risk of stack
- overflow. The size is also chosen to allow using the small stack for most
- function calls of the Python standard library. On 64-bit CPU, it allocates
- 40 bytes on the stack. */
-#define _PY_FASTCALL_SMALL_STACK 5
-
-/* Return 1 if callable supports FASTCALL calling convention for positional
- arguments: see _PyObject_FastCallDict() and _PyObject_FastCallKeywords() */
-PyAPI_FUNC(int) _PyObject_HasFastCall(PyObject *callable);
-
-/* Call the callable object 'callable' 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.
-
- If nargs is equal to zero, args can be NULL. kwargs can be NULL.
- nargs must be greater or equal to zero.
-
- Return the result on success. Raise an exception on return NULL on
- error. */
-PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(
- PyObject *callable,
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwargs);
-
-/* Call the callable object 'callable' with the "fast call" calling convention:
- args is a C array for positional arguments followed by values of
- keyword arguments. Keys of keyword arguments are stored as a tuple
- of strings in kwnames. nargs is the number of positional parameters at
- the beginning of stack. The size of kwnames gives the number of keyword
- values in the stack after positional arguments.
-
- kwnames must only contains str strings, no subclass, and all keys must
- be unique.
-
- If nargs is equal to zero and there is no keyword argument (kwnames is
- NULL or its size is zero), args can be NULL.
-
- Return the result on success. Raise an exception and return NULL on
- error. */
-PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords(
- PyObject *callable,
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwnames);
-
-#define _PyObject_FastCall(func, args, nargs) \
- _PyObject_FastCallDict((func), (args), (nargs), NULL)
-
-#define _PyObject_CallNoArg(func) \
- _PyObject_FastCallDict((func), NULL, 0, NULL)
-
-PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
- PyObject *callable,
- PyObject *obj,
- PyObject *args,
- PyObject *kwargs);
-
-PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend(
- PyObject *callable,
- PyObject *obj,
- PyObject *const *args,
- Py_ssize_t nargs);
-
-PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,
- PyObject *result,
- const char *where);
-#endif /* Py_LIMITED_API */
-
-
-/* Call a callable Python object 'callable', with arguments given by the
- tuple 'args'. If no arguments are needed, then 'args' can be *NULL*.
-
- Returns the result of the call on success, or *NULL* on failure.
-
- This is the equivalent of the Python expression:
- callable(*args). */
-PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable,
- PyObject *args);
-
-/* Call a callable Python object, callable, with a variable number of C
- arguments. The C arguments are described using a mkvalue-style format
- string.
-
- The format may be NULL, indicating that no arguments are provided.
-
- Returns the result of the call on success, or NULL on failure.
-
- This is the equivalent of the Python expression:
- callable(arg1, arg2, ...). */
-PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable,
- const char *format, ...);
-
-/* Call the method named 'name' of object 'obj' with a variable number of
- C arguments. The C arguments are described by a mkvalue format string.
-
- The format can be NULL, indicating that no arguments are provided.
-
- Returns the result of the call on success, or NULL on failure.
-
- This is the equivalent of the Python expression:
- obj.name(arg1, arg2, ...). */
-PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
- const char *name,
- const char *format, ...);
-
-#ifndef Py_LIMITED_API
-/* Like PyObject_CallMethod(), but expect a _Py_Identifier*
- as the method name. */
-PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
- _Py_Identifier *name,
- const char *format, ...);
-#endif /* !Py_LIMITED_API */
-
-PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
- const char *format,
- ...);
-
-PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj,
- const char *name,
- const char *format,
- ...);
-
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj,
- _Py_Identifier *name,
- const char *format,
- ...);
-#endif /* !Py_LIMITED_API */
-
-/* Call a callable Python object 'callable' with a variable number of C
- arguments. The C arguments are provided as PyObject* values, terminated
- by a NULL.
-
- Returns the result of the call on success, or NULL on failure.
-
- This is the equivalent of the Python expression:
- callable(arg1, arg2, ...). */
-PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
- ...);
-
-/* Call the method named 'name' of object 'obj' with a variable number of
- C arguments. The C arguments are provided as PyObject* values, terminated
- by NULL.
-
- Returns the result of the call on success, or NULL on failure.
-
- This is the equivalent of the Python expression: obj.name(*args). */
-
-PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(
- PyObject *obj,
- PyObject *name,
- ...);
-
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(
- PyObject *obj,
- struct _Py_Identifier *name,
- ...);
-#endif /* !Py_LIMITED_API */
-
-
/* Implemented elsewhere:
Py_hash_t PyObject_Hash(PyObject *o);
diff --git a/Include/call.h b/Include/call.h
new file mode 100644
index 00000000000000..ed1106f0fd3c3b
--- /dev/null
+++ b/Include/call.h
@@ -0,0 +1,370 @@
+#ifndef Py_CALL_H
+#define Py_CALL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* --- PyMethodDef ------------------------------------------------ */
+
+/* Various function types which can appear in ml_meth. The signature
+ depends on the METH_xxx flags */
+typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
+typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *,
+ PyObject *);
+typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t);
+typedef PyObject *(*_PyCFunctionFastWithKeywords) (PyObject *,
+ PyObject *const *, Py_ssize_t,
+ PyObject *);
+
+
+struct PyMethodDef {
+ const char *ml_name; /* The name of the built-in function/method */
+ PyCFunction ml_meth; /* The C function that implements it */
+ int ml_flags; /* Combination of METH_xxx flags, which mostly
+ describes the args expected by the C func */
+ const char *ml_doc; /* The __doc__ attribute, or NULL */
+};
+typedef struct PyMethodDef PyMethodDef;
+
+/* Flags for PyMethodDef */
+/* Exactly one of these 4 must be set */
+#define METH_VARARGS 0x0001
+#ifndef Py_LIMITED_API
+#define METH_FASTCALL 0x0080
+#endif
+#define METH_NOARGS 0x0004
+#define METH_O 0x0008
+
+/* Can be combined with METH_VARARGS and METH_FASTCALL */
+#define METH_KEYWORDS 0x0002
+
+/* METH_CLASS and METH_STATIC control the construction of methods for a
+ class. These cannot be used for functions in modules. */
+#define METH_CLASS 0x0010
+#define METH_STATIC 0x0020
+
+/* METH_COEXIST allows a method to be entered even though a slot has
+ already filled the entry. When defined, the flag allows a separate
+ method, "__contains__" for example, to coexist with a defined
+ slot like sq_contains. */
+#define METH_COEXIST 0x0040
+
+/* This bit is preserved for Stackless Python */
+#ifdef STACKLESS
+#define METH_STACKLESS 0x0100
+#else
+#define METH_STACKLESS 0x0000
+#endif
+
+
+/* --- Calls for specific classes --------------------------------- */
+
+PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
+
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func,
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwargs);
+
+PyAPI_FUNC(PyObject *) _PyCFunction_FastCallKeywords(PyObject *func,
+ PyObject *const *stack,
+ Py_ssize_t nargs,
+ PyObject *kwnames);
+
+PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict(
+ PyObject *func,
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwargs);
+
+PyAPI_FUNC(PyObject *) _PyFunction_FastCallKeywords(
+ PyObject *func,
+ PyObject *const *stack,
+ Py_ssize_t nargs,
+ PyObject *kwnames);
+
+PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallDict(
+ PyMethodDef *method,
+ PyObject *self,
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwargs);
+
+PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallKeywords(
+ PyMethodDef *method,
+ PyObject *self,
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwnames);
+#endif
+
+
+/* --- Convert FASTCALL arguments to other types ------------------ */
+
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject*) _PyStack_AsTuple(
+ PyObject *const *stack,
+ Py_ssize_t nargs);
+
+PyAPI_FUNC(PyObject*) _PyStack_AsTupleSlice(
+ PyObject *const *stack,
+ Py_ssize_t nargs,
+ Py_ssize_t start,
+ Py_ssize_t end);
+
+/* Convert keyword arguments from the FASTCALL (stack: C array, kwnames: tuple)
+ format to a Python dictionary ("kwargs" dict).
+
+ The type of kwnames keys is not checked. The final function getting
+ arguments is responsible to check if all keys are strings, for example using
+ PyArg_ParseTupleAndKeywords() or PyArg_ValidateKeywordArguments().
+
+ Duplicate keys are merged using the last value. If duplicate keys must raise
+ an exception, the caller is responsible to implement an explicit keys on
+ kwnames. */
+PyAPI_FUNC(PyObject *) _PyStack_AsDict(
+ PyObject *const *values,
+ PyObject *kwnames);
+
+/* Convert (args, nargs, kwargs: dict) into a (stack, nargs, kwnames: tuple).
+
+ Return 0 on success, raise an exception and return -1 on error.
+
+ Write the new stack into *p_stack. If *p_stack is differen than args, it
+ must be released by PyMem_Free().
+
+ The stack uses borrowed references.
+
+ The type of keyword keys is not checked, these checks should be done
+ later (ex: _PyArg_ParseStackAndKeywords). */
+PyAPI_FUNC(int) _PyStack_UnpackDict(
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwargs,
+ PyObject *const **p_stack,
+ PyObject **p_kwnames);
+
+/* Suggested size (number of positional arguments) for arrays of PyObject*
+ allocated on a C stack to avoid allocating memory on the heap memory. Such
+ array is used to pass positional arguments to call functions of the
+ _PyObject_FastCall() family.
+
+ The size is chosen to not abuse the C stack and so limit the risk of stack
+ overflow. The size is also chosen to allow using the small stack for most
+ function calls of the Python standard library. On 64-bit CPU, it allocates
+ 40 bytes on the stack. */
+#define _PY_FASTCALL_SMALL_STACK 5
+#endif
+
+
+/* --- Generic call functions ------------------------------------- */
+
+#ifdef PY_SSIZE_T_CLEAN
+# define PyObject_CallFunction _PyObject_CallFunction_SizeT
+# define PyObject_CallMethod _PyObject_CallMethod_SizeT
+# ifndef Py_LIMITED_API
+# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT
+# endif /* !Py_LIMITED_API */
+#endif
+
+/* Call a callable Python object 'callable' with arguments given by the
+ tuple 'args' and keywords arguments given by the dictionary 'kwargs'.
+
+ 'args' must not be *NULL*, use an empty tuple if no arguments are
+ needed. If no named arguments are needed, 'kwargs' can be NULL.
+
+ This is the equivalent of the Python expression:
+ callable(*args, **kwargs). */
+PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable,
+ PyObject *args, PyObject *kwargs);
+
+#ifndef Py_LIMITED_API
+/* Return 1 if callable supports FASTCALL calling convention for positional
+ arguments: see _PyObject_FastCallDict() and _PyObject_FastCallKeywords() */
+PyAPI_FUNC(int) _PyObject_HasFastCall(PyObject *callable);
+
+/* Call the callable object 'callable' 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.
+
+ If nargs is equal to zero, args can be NULL. kwargs can be NULL.
+ nargs must be greater or equal to zero.
+
+ Return the result on success. Raise an exception on return NULL on
+ error. */
+PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(
+ PyObject *callable,
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwargs);
+
+/* Call the callable object 'callable' with the "fast call" calling convention:
+ args is a C array for positional arguments followed by values of
+ keyword arguments. Keys of keyword arguments are stored as a tuple
+ of strings in kwnames. nargs is the number of positional parameters at
+ the beginning of stack. The size of kwnames gives the number of keyword
+ values in the stack after positional arguments.
+
+ kwnames must only contains str strings, no subclass, and all keys must
+ be unique.
+
+ If nargs is equal to zero and there is no keyword argument (kwnames is
+ NULL or its size is zero), args can be NULL.
+
+ Return the result on success. Raise an exception and return NULL on
+ error. */
+PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords(
+ PyObject *callable,
+ PyObject *const *args,
+ Py_ssize_t nargs,
+ PyObject *kwnames);
+
+#define _PyObject_FastCall(func, args, nargs) \
+ _PyObject_FastCallDict((func), (args), (nargs), NULL)
+
+#define _PyObject_CallNoArg(func) \
+ _PyObject_FastCallDict((func), NULL, 0, NULL)
+
+PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
+ PyObject *callable,
+ PyObject *obj,
+ PyObject *args,
+ PyObject *kwargs);
+
+PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend(
+ PyObject *callable,
+ PyObject *obj,
+ PyObject *const *args,
+ Py_ssize_t nargs);
+#endif /* Py_LIMITED_API */
+
+
+/* Call a callable Python object 'callable', with arguments given by the
+ tuple 'args'. If no arguments are needed, then 'args' can be *NULL*.
+
+ Returns the result of the call on success, or *NULL* on failure.
+
+ This is the equivalent of the Python expression:
+ callable(*args). */
+PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable,
+ PyObject *args);
+
+/* Call a callable Python object, callable, with a variable number of C
+ arguments. The C arguments are described using a mkvalue-style format
+ string.
+
+ The format may be NULL, indicating that no arguments are provided.
+
+ Returns the result of the call on success, or NULL on failure.
+
+ This is the equivalent of the Python expression:
+ callable(arg1, arg2, ...). */
+PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable,
+ const char *format, ...);
+
+/* Call the method named 'name' of object 'obj' with a variable number of
+ C arguments. The C arguments are described by a mkvalue format string.
+
+ The format can be NULL, indicating that no arguments are provided.
+
+ Returns the result of the call on success, or NULL on failure.
+
+ This is the equivalent of the Python expression:
+ obj.name(arg1, arg2, ...). */
+PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj,
+ const char *name,
+ const char *format, ...);
+
+#ifndef Py_LIMITED_API
+/* Like PyObject_CallMethod(), but expect a _Py_Identifier*
+ as the method name. */
+PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
+ _Py_Identifier *name,
+ const char *format, ...);
+#endif /* !Py_LIMITED_API */
+
+PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable,
+ const char *format,
+ ...);
+
+PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj,
+ const char *name,
+ const char *format,
+ ...);
+
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj,
+ _Py_Identifier *name,
+ const char *format,
+ ...);
+#endif /* !Py_LIMITED_API */
+
+/* Call a callable Python object 'callable' with a variable number of C
+ arguments. The C arguments are provided as PyObject* values, terminated
+ by a NULL.
+
+ Returns the result of the call on success, or NULL on failure.
+
+ This is the equivalent of the Python expression:
+ callable(arg1, arg2, ...). */
+PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable,
+ ...);
+
+/* Call the method named 'name' of object 'obj' with a variable number of
+ C arguments. The C arguments are provided as PyObject* values, terminated
+ by NULL.
+
+ Returns the result of the call on success, or NULL on failure.
+
+ This is the equivalent of the Python expression: obj.name(*args). */
+
+PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(
+ PyObject *obj,
+ PyObject *name,
+ ...);
+
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(
+ PyObject *obj,
+ struct _Py_Identifier *name,
+ ...);
+#endif /* !Py_LIMITED_API */
+
+
+/* --- Internal helper function ----------------------------------- */
+
+PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,
+ PyObject *result,
+ const char *where);
+
+
+/* --- Backwards compatibility ------------------------------------ */
+
+typedef PyObject *(*PyNoArgsFunction)(PyObject *);
+
+/* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction
+ * and PyEval_CallMethod are kept for backward compatibility: PyObject_Call(),
+ * PyObject_CallFunction() and PyObject_CallMethod() are recommended to call
+ * a callable object.
+ */
+PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
+ PyObject *callable,
+ PyObject *args,
+ PyObject *kwargs);
+
+#define PyEval_CallObject(callable, arg) \
+ PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL)
+
+PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *callable,
+ const char *format, ...);
+PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
+ const char *name,
+ const char *format, ...);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_CALL_H */
diff --git a/Include/ceval.h b/Include/ceval.h
index bce8a0beed85e1..0aef9b6cad9af7 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -7,27 +7,6 @@ extern "C" {
/* Interface to random parts in ceval.c */
-/* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction
- * and PyEval_CallMethod are kept for backward compatibility: PyObject_Call(),
- * PyObject_CallFunction() and PyObject_CallMethod() are recommended to call
- * a callable object.
- */
-
-PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
- PyObject *callable,
- PyObject *args,
- PyObject *kwargs);
-
-/* Inline this */
-#define PyEval_CallObject(callable, arg) \
- PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL)
-
-PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *callable,
- const char *format, ...);
-PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj,
- const char *name,
- const char *format, ...);
-
#ifndef Py_LIMITED_API
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
diff --git a/Include/funcobject.h b/Include/funcobject.h
index 86674ac90a08de..74e56d07a30bb7 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -58,20 +58,6 @@ PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyFunction_GetAnnotations(PyObject *);
PyAPI_FUNC(int) PyFunction_SetAnnotations(PyObject *, PyObject *);
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) _PyFunction_FastCallDict(
- PyObject *func,
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwargs);
-
-PyAPI_FUNC(PyObject *) _PyFunction_FastCallKeywords(
- PyObject *func,
- PyObject *const *stack,
- Py_ssize_t nargs,
- PyObject *kwnames);
-#endif
-
/* Macros for direct access to these values. Type checks are *not*
done, so use with care. */
#define PyFunction_GET_CODE(func) \
diff --git a/Include/methodobject.h b/Include/methodobject.h
index ea35d86bcd171d..f5b4f83461e862 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -15,15 +15,6 @@ PyAPI_DATA(PyTypeObject) PyCFunction_Type;
#define PyCFunction_Check(op) (Py_TYPE(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 *(*PyNoArgsFunction)(PyObject *);
-
PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *);
PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
@@ -39,65 +30,12 @@ PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *);
#define PyCFunction_GET_FLAGS(func) \
(((PyCFunctionObject *)func) -> m_ml -> ml_flags)
#endif
-PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *);
-
-#ifndef Py_LIMITED_API
-PyAPI_FUNC(PyObject *) _PyCFunction_FastCallDict(PyObject *func,
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwargs);
-
-PyAPI_FUNC(PyObject *) _PyCFunction_FastCallKeywords(PyObject *func,
- PyObject *const *stack,
- Py_ssize_t nargs,
- PyObject *kwnames);
-#endif
-struct PyMethodDef {
- const char *ml_name; /* The name of the built-in function/method */
- PyCFunction ml_meth; /* The C function that implements it */
- int ml_flags; /* Combination of METH_xxx flags, which mostly
- describe the args expected by the C func */
- const char *ml_doc; /* The __doc__ attribute, or NULL */
-};
-typedef struct PyMethodDef PyMethodDef;
#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
PyObject *);
-/* Flag passed to newmethodobject */
-/* #define METH_OLDARGS 0x0000 -- unsupported now */
-#define METH_VARARGS 0x0001
-#define METH_KEYWORDS 0x0002
-/* METH_NOARGS and METH_O must not be combined with the flags above. */
-#define METH_NOARGS 0x0004
-#define METH_O 0x0008
-
-/* METH_CLASS and METH_STATIC are a little different; these control
- the construction of methods for a class. These cannot be used for
- functions in modules. */
-#define METH_CLASS 0x0010
-#define METH_STATIC 0x0020
-
-/* METH_COEXIST allows a method to be entered even though a slot has
- already filled the entry. When defined, the flag allows a separate
- method, "__contains__" for example, to coexist with a defined
- slot like sq_contains. */
-
-#define METH_COEXIST 0x0040
-
-#ifndef Py_LIMITED_API
-#define METH_FASTCALL 0x0080
-#endif
-
-/* This bit is preserved for Stackless Python */
-#ifdef STACKLESS
-#define METH_STACKLESS 0x0100
-#else
-#define METH_STACKLESS 0x0000
-#endif
-
#ifndef Py_LIMITED_API
typedef struct {
PyObject_HEAD
@@ -106,20 +44,6 @@ typedef struct {
PyObject *m_module; /* The __module__ attribute, can be anything */
PyObject *m_weakreflist; /* List of weak references */
} PyCFunctionObject;
-
-PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallDict(
- PyMethodDef *method,
- PyObject *self,
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwargs);
-
-PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallKeywords(
- PyMethodDef *method,
- PyObject *self,
- PyObject *const *args,
- Py_ssize_t nargs,
- PyObject *kwnames);
#endif
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 0ed2cdf079a43a..969c0219db038e 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -947,6 +947,7 @@ PYTHON_HEADERS= \
$(srcdir)/Include/bytes_methods.h \
$(srcdir)/Include/bytearrayobject.h \
$(srcdir)/Include/bytesobject.h \
+ $(srcdir)/Include/call.h \
$(srcdir)/Include/cellobject.h \
$(srcdir)/Include/ceval.h \
$(srcdir)/Include/classobject.h \
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
index 90330faa0cf26f..7d8fba2e222a70 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -87,6 +87,7 @@
+
diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters
index b51fd54f8b4db6..9799143ea23bc1 100644
--- a/PCbuild/pythoncore.vcxproj.filters
+++ b/PCbuild/pythoncore.vcxproj.filters
@@ -60,6 +60,9 @@
Include
+
+ Include
+
Include