mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-139525: Don't specialize functions which have a modified vectorcall (GH-139524) (#139709)
Don't specialize functions which have a modified vectorcall
This commit is contained in:
parent
1c1a0bdfdc
commit
81dc8b12f0
3 changed files with 37 additions and 0 deletions
|
|
@ -2389,6 +2389,25 @@ emscripten_set_up_async_input_device(PyObject *self, PyObject *Py_UNUSED(ignored
|
|||
}
|
||||
#endif
|
||||
|
||||
static PyObject *
|
||||
vectorcall_nop(PyObject *callable, PyObject *const *args,
|
||||
size_t nargsf, PyObject *kwnames)
|
||||
{
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
set_vectorcall_nop(PyObject *self, PyObject *func)
|
||||
{
|
||||
if (!PyFunction_Check(func)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expected function");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
((PyFunctionObject*)func)->vectorcall = vectorcall_nop;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyMethodDef module_functions[] = {
|
||||
{"get_configs", get_configs, METH_NOARGS},
|
||||
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
|
||||
|
|
@ -2496,6 +2515,7 @@ static PyMethodDef module_functions[] = {
|
|||
#ifdef __EMSCRIPTEN__
|
||||
{"emscripten_set_up_async_input_device", emscripten_set_up_async_input_device, METH_NOARGS},
|
||||
#endif
|
||||
{"set_vectorcall_nop", set_vectorcall_nop, METH_O},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue