summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authoradphrost <104581013+adphrost@users.noreply.github.com>2022-09-15 15:42:37 (GMT)
committerGitHub <noreply@github.com>2022-09-15 15:42:37 (GMT)
commita41ed975e863ae0ca435783596f14f8492d62f8d (patch)
treeb87ceae5a7c55e1131a7cdf02b0cda2b6ca41eaf /Objects
parente37ac5fbb6de593521cf218aa05bc58a45c5a7c9 (diff)
downloadcpython-a41ed975e863ae0ca435783596f14f8492d62f8d.zip
cpython-a41ed975e863ae0ca435783596f14f8492d62f8d.tar.gz
cpython-a41ed975e863ae0ca435783596f14f8492d62f8d.tar.bz2
GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)
Co-authored-by: Andrew Frost <adfrost@fb.com> Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/funcobject.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index 32b4155..7f257a9 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -134,6 +134,9 @@ uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func)
if (func->func_version != 0) {
return func->func_version;
}
+ if (func->vectorcall != _PyFunction_Vectorcall) {
+ return 0;
+ }
if (next_func_version == 0) {
return 0;
}
@@ -209,6 +212,14 @@ PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
return 0;
}
+void
+PyFunction_SetVectorcall(PyFunctionObject *func, vectorcallfunc vectorcall)
+{
+ assert(func != NULL);
+ func->func_version = 0;
+ func->vectorcall = vectorcall;
+}
+
PyObject *
PyFunction_GetKwDefaults(PyObject *op)
{