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-91049: Introduce set vectorcall field API for PyFunctionObject#92257
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
9cf96ec282e3dcedcdcf1debf5a9473d18d76e8c9d33374591543f4408082bded9332724ffd3089cb4b23387d4ab0cc28a99e408524353c860f7769376ee7556ffc705340e87a5e9d1312faf5266234709149f14e732d7e84874fbFile 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 |
|---|---|---|
| @@ -5285,6 +5285,26 @@ test_pyobject_vectorcall(PyObject *self, PyObject *args) | ||
| } | ||
| static PyObject * | ||
| override_vectorcall( | ||
| PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames) { | ||
| Py_RETURN_NONE; | ||
| ||
| } | ||
| static PyObject * | ||
| test_pyobject_setvectorcall(PyObject *self, PyObject *args) | ||
| { | ||
| PyFunctionObject *func = NULL; | ||
| if (!PyArg_ParseTuple(args, "O", &func)) { | ||
adphrost marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| return NULL; | ||
| } | ||
| if(PyFunction_SetVectorcall(func, (vectorcallfunc)override_vectorcall) != 0) { | ||
| PyErr_SetString(PyExc_TypeError, "Something went wrong setting vectorcall field"); | ||
| return NULL; | ||
| } | ||
| Py_RETURN_NONE; | ||
| } | ||
| static PyObject * | ||
| test_pyvectorcall_call(PyObject *self, PyObject *args) | ||
| { | ||
| @@ -6186,6 +6206,7 @@ static PyMethodDef TestMethods[] = { | ||
| {"pyobject_fastcall", test_pyobject_fastcall, METH_VARARGS}, | ||
| {"pyobject_fastcalldict", test_pyobject_fastcalldict, METH_VARARGS}, | ||
| {"pyobject_vectorcall", test_pyobject_vectorcall, METH_VARARGS}, | ||
| {"pyobject_setvectorcall", test_pyobject_setvectorcall, METH_VARARGS}, | ||
adphrost marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| {"pyvectorcall_call", test_pyvectorcall_call, METH_VARARGS}, | ||
| {"stack_pointer", stack_pointer, METH_NOARGS}, | ||
| #ifdef W_STOPCODE | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -133,6 +133,9 @@ uint32_t _PyFunction_GetVersionForCurrentState(PyFunctionObject *func) | ||
| if (func->func_version != 0) { | ||
| return func->func_version; | ||
| } | ||
| if (func->vectorcall != _PyFunction_Vectorcall) { | ||
| return 0; | ||
markshannon marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| } | ||
| if (next_func_version == 0) { | ||
| return 0; | ||
| } | ||
| @@ -208,6 +211,14 @@ PyFunction_SetDefaults(PyObject *op, PyObject *defaults) | ||
| return 0; | ||
| } | ||
| int | ||
adphrost marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| PyFunction_SetVectorcall(PyFunctionObject *func, vectorcallfunc vectorcall) | ||
| { | ||
| func->func_version = 0; | ||
erlend-aasland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| func->vectorcall = vectorcall; | ||
| return 0; | ||
| } | ||
| PyObject * | ||
| PyFunction_GetKwDefaults(PyObject *op) | ||
| { | ||