summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-11-14 12:36:21 (GMT)
committerGitHub <noreply@github.com>2019-11-14 12:36:21 (GMT)
commit4d231bcc77ac8ce7d11bda0804130dcdd678f710 (patch)
tree5cb1019d966e2e29977430b0824d11ccf8bd24e4 /Include/internal
parentb9e681261cd5ce6db0a79461c58d7cc52cfa4902 (diff)
downloadcpython-4d231bcc77ac8ce7d11bda0804130dcdd678f710.zip
cpython-4d231bcc77ac8ce7d11bda0804130dcdd678f710.tar.gz
cpython-4d231bcc77ac8ce7d11bda0804130dcdd678f710.tar.bz2
bpo-38644: Add _PyObject_Call() (GH-17089)
* Add pycore_call.h internal header file. * Add _PyObject_Call(): PyObject_Call() with tstate * Add _PyObject_CallNoArgTstate(): _PyObject_CallNoArg() with tstate * Add _PyObject_FastCallDictTstate(): _PyObject_FastCallDict() with tstate * _PyObject_Call_Prepend() now takes tstate * Replace _PyObject_FastCall() calls with _PyObject_VectorcallTstate() calls
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_call.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Include/internal/pycore_call.h b/Include/internal/pycore_call.h
new file mode 100644
index 0000000..f7d856a
--- /dev/null
+++ b/Include/internal/pycore_call.h
@@ -0,0 +1,39 @@
+#ifndef Py_INTERNAL_CALL_H
+#define Py_INTERNAL_CALL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef Py_BUILD_CORE
+# error "this header requires Py_BUILD_CORE define"
+#endif
+
+PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
+ PyThreadState *tstate,
+ PyObject *callable,
+ PyObject *obj,
+ PyObject *args,
+ PyObject *kwargs);
+
+PyAPI_FUNC(PyObject *) _PyObject_FastCallDictTstate(
+ PyThreadState *tstate,
+ PyObject *callable,
+ PyObject *const *args,
+ size_t nargsf,
+ PyObject *kwargs);
+
+PyAPI_FUNC(PyObject *) _PyObject_Call(
+ PyThreadState *tstate,
+ PyObject *callable,
+ PyObject *args,
+ PyObject *kwargs);
+
+static inline PyObject *
+_PyObject_CallNoArgTstate(PyThreadState *tstate, PyObject *func) {
+ return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL);
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_INTERNAL_CALL_H */