-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
gh-104469 Convert_testcapi/vectorcall.c to use AC #106557
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2442d02
291f92f
fcf998f
5ee06e7
92d897b
24dd765
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,10 @@ | |||||
#include "structmember.h" // PyMemberDef | ||||||
#include <stddef.h> // offsetof | ||||||
|
||||||
/*[clinic input] | ||||||
module _testcapi | ||||||
[clinic start generated code]*/ | ||||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6361033e795369fc]*/ | ||||||
|
||||||
/* Test PEP 590 - Vectorcall */ | ||||||
|
||||||
|
@@ -25,18 +29,23 @@ fastcall_args(PyObject *args, PyObject ***stack, Py_ssize_t *nargs) | |||||
return 0; | ||||||
} | ||||||
|
||||||
/*[clinic input] | ||||||
_testcapi.test_pyobject_fastcalldict | ||||||
func: object | ||||||
func_args: object | ||||||
kwargs: object | ||||||
/ | ||||||
[clinic start generated code]*/ | ||||||
|
||||||
static PyObject * | ||||||
test_pyobject_fastcalldict(PyObject *self, PyObject *args) | ||||||
_testcapi_test_pyobject_fastcalldict_impl(PyObject *module, PyObject *func, | ||||||
PyObject *func_args, | ||||||
PyObject *kwargs) | ||||||
/*[clinic end generated code: output=a39da56b27d27212 input=94464574e929fbe5]*/ | ||||||
{ | ||||||
PyObject *func, *func_args, *kwargs; | ||||||
PyObject **stack; | ||||||
Py_ssize_t nargs; | ||||||
|
||||||
if (!PyArg_ParseTuple(args, "OOO", &func, &func_args, &kwargs)) { | ||||||
return NULL; | ||||||
} | ||||||
|
||||||
if (fastcall_args(func_args, &stack, &nargs) < 0) { | ||||||
return NULL; | ||||||
} | ||||||
|
@@ -52,17 +61,23 @@ test_pyobject_fastcalldict(PyObject *self, PyObject *args) | |||||
return PyObject_VectorcallDict(func, stack, nargs, kwargs); | ||||||
} | ||||||
|
||||||
/*[clinic input] | ||||||
_testcapi.test_pyobject_vectorcall | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
func: object | ||||||
func_args: object | ||||||
kwnames: object = NULL | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/ | ||||||
[clinic start generated code]*/ | ||||||
|
||||||
static PyObject * | ||||||
test_pyobject_vectorcall(PyObject *self, PyObject *args) | ||||||
_testcapi_test_pyobject_vectorcall_impl(PyObject *module, PyObject *func, | ||||||
PyObject *func_args, | ||||||
PyObject *kwnames) | ||||||
/*[clinic end generated code: output=bb25a5410142b848 input=14dd1f8bbc465b49]*/ | ||||||
{ | ||||||
PyObject *func, *func_args, *kwnames = NULL; | ||||||
PyObject **stack; | ||||||
Py_ssize_t nargs, nkw; | ||||||
|
||||||
if (!PyArg_ParseTuple(args, "OOO", &func, &func_args, &kwnames)) { | ||||||
return NULL; | ||||||
} | ||||||
|
||||||
if (fastcall_args(func_args, &stack, &nargs) < 0) { | ||||||
return NULL; | ||||||
} | ||||||
|
@@ -103,17 +118,19 @@ function_setvectorcall(PyObject *self, PyObject *func) | |||||
Py_RETURN_NONE; | ||||||
} | ||||||
|
||||||
/*[clinic input] | ||||||
_testcapi.test_pyvectorcall_call | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
func: object | ||||||
argstuple: object | ||||||
kwargs: object = NULL | ||||||
/ | ||||||
[clinic start generated code]*/ | ||||||
|
||||||
static PyObject * | ||||||
test_pyvectorcall_call(PyObject *self, PyObject *args) | ||||||
_testcapi_test_pyvectorcall_call_impl(PyObject *module, PyObject *func, | ||||||
PyObject *argstuple, PyObject *kwargs) | ||||||
/*[clinic end generated code: output=f9f5cbdfe90dd6d6 input=4cc647aa0c81365a]*/ | ||||||
{ | ||||||
PyObject *func; | ||||||
PyObject *argstuple; | ||||||
PyObject *kwargs = NULL; | ||||||
|
||||||
if (!PyArg_ParseTuple(args, "OO|O", &func, &argstuple, &kwargs)) { | ||||||
return NULL; | ||||||
} | ||||||
|
||||||
if (!PyTuple_Check(argstuple)) { | ||||||
PyErr_SetString(PyExc_TypeError, "args must be a tuple"); | ||||||
return NULL; | ||||||
|
@@ -242,10 +259,10 @@ _testcapi_has_vectorcall_flag_impl(PyObject *module, PyTypeObject *type) | |||||
} | ||||||
|
||||||
static PyMethodDef TestMethods[] = { | ||||||
{"pyobject_fastcalldict", test_pyobject_fastcalldict, METH_VARARGS}, | ||||||
{"pyobject_vectorcall", test_pyobject_vectorcall, METH_VARARGS}, | ||||||
_TESTCAPI_TEST_PYOBJECT_FASTCALLDICT_METHODDEF | ||||||
_TESTCAPI_TEST_PYOBJECT_VECTORCALL_METHODDEF | ||||||
{"function_setvectorcall", function_setvectorcall, METH_O}, | ||||||
{"pyvectorcall_call", test_pyvectorcall_call, METH_VARARGS}, | ||||||
_TESTCAPI_TEST_PYVECTORCALL_CALL_METHODDEF | ||||||
_TESTCAPI_MAKE_VECTORCALL_CLASS_METHODDEF | ||||||
_TESTCAPI_HAS_VECTORCALL_FLAG_METHODDEF | ||||||
{NULL}, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.