Skip to content

Commit 8004d79

Browse files
vstinnernahyeon-an
andcommitted
pythongh-104469: Convert _testcapi/vectorcall_limited.c to use AC
Co-Authored-By: nahyeon <55136494+nahyeon-an@users.noreply.github.com>
1 parent 5b8f024 commit 8004d79

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

Modules/_testcapi/clinic/vectorcall_limited.c.h

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/_testcapi/vectorcall_limited.c

+27-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
/* Test Vectorcall in the limited API */
2+
13
#define Py_LIMITED_API 0x030c0000 // 3.12
24
#include "parts.h"
5+
#include "clinic/vectorcall_limited.c.h"
36

4-
/* Test Vectorcall in the limited API */
7+
/*[clinic input]
8+
module _testcapi
9+
[clinic start generated code]*/
10+
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6361033e795369fc]*/
511

612
static PyObject *
713
LimitedVectorCallClass_tpcall(PyObject *self, PyObject *args, PyObject *kwargs) {
@@ -28,8 +34,16 @@ LimitedVectorCallClass_new(PyTypeObject *tp, PyTypeObject *a, PyTypeObject *kw)
2834
return self;
2935
}
3036

37+
/*[clinic input]
38+
_testcapi.call_vectorcall
39+
40+
callable: object
41+
/
42+
[clinic start generated code]*/
43+
3144
static PyObject *
32-
call_vectorcall(PyObject* self, PyObject *callable)
45+
_testcapi_call_vectorcall(PyObject *module, PyObject *callable)
46+
/*[clinic end generated code: output=bae81eec97fcaad7 input=55d88f92240957ee]*/
3347
{
3448
PyObject *args[3] = { NULL, NULL, NULL };
3549
PyObject *kwname = NULL, *kwnames = NULL, *result = NULL;
@@ -73,8 +87,16 @@ call_vectorcall(PyObject* self, PyObject *callable)
7387
return result;
7488
}
7589

90+
/*[clinic input]
91+
_testcapi.call_vectorcall_method
92+
93+
callable: object
94+
/
95+
[clinic start generated code]*/
96+
7697
static PyObject *
77-
call_vectorcall_method(PyObject* self, PyObject *callable)
98+
_testcapi_call_vectorcall_method(PyObject *module, PyObject *callable)
99+
/*[clinic end generated code: output=e661f48dda08b6fb input=5ba81c27511395b6]*/
78100
{
79101
PyObject *args[3] = { NULL, NULL, NULL };
80102
PyObject *name = NULL, *kwname = NULL,
@@ -149,8 +171,8 @@ static PyType_Spec LimitedVectorCallClass_spec = {
149171
};
150172

151173
static PyMethodDef TestMethods[] = {
152-
{"call_vectorcall", call_vectorcall, METH_O},
153-
{"call_vectorcall_method", call_vectorcall_method, METH_O},
174+
_TESTCAPI_CALL_VECTORCALL_METHODDEF
175+
_TESTCAPI_CALL_VECTORCALL_METHOD_METHODDEF
154176
{NULL},
155177
};
156178

0 commit comments

Comments
 (0)