Skip to content

Commit 9619e51

Browse files
authored
[3.12] gh-111495: add stub files for C API test modules (GH-111586) (GH-111592)
This is to reduce merge conflicts (Modules/Setup.stdlib.in) for subsequent pull requests for the issue. (cherry picked from commit 33ed5fa)
1 parent 2162512 commit 9619e51

File tree

13 files changed

+204
-3
lines changed

13 files changed

+204
-3
lines changed

Modules/Setup.stdlib.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
@MODULE__XXTESTFUZZ_TRUE@_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
169169
@MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c
170170
@MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c
171-
@MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c _testcapi/vectorcall.c _testcapi/vectorcall_limited.c _testcapi/heaptype.c _testcapi/abstract.c _testcapi/unicode.c _testcapi/dict.c _testcapi/set.c _testcapi/getargs.c _testcapi/pytime.c _testcapi/datetime.c _testcapi/docstring.c _testcapi/mem.c _testcapi/watchers.c _testcapi/long.c _testcapi/float.c _testcapi/structmember.c _testcapi/exceptions.c _testcapi/code.c _testcapi/buffer.c _testcapi/pyos.c _testcapi/immortal.c _testcapi/heaptype_relative.c _testcapi/gc.c _testcapi/sys.c
171+
@MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c _testcapi/vectorcall.c _testcapi/vectorcall_limited.c _testcapi/heaptype.c _testcapi/abstract.c _testcapi/bytearray.c _testcapi/bytes.c _testcapi/unicode.c _testcapi/dict.c _testcapi/set.c _testcapi/list.c _testcapi/tuple.c _testcapi/getargs.c _testcapi/pytime.c _testcapi/datetime.c _testcapi/docstring.c _testcapi/mem.c _testcapi/watchers.c _testcapi/long.c _testcapi/float.c _testcapi/complex.c _testcapi/numbers.c _testcapi/structmember.c _testcapi/exceptions.c _testcapi/code.c _testcapi/buffer.c _testcapi/pyos.c _testcapi/file.c _testcapi/codec.c _testcapi/immortal.c _testcapi/heaptype_relative.c _testcapi/gc.c _testcapi/sys.c
172172
@MODULE__TESTCLINIC_TRUE@_testclinic _testclinic.c
173173

174174
# Some testing modules MUST be built as shared libraries.

Modules/_testcapi/bytearray.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
5+
static PyMethodDef test_methods[] = {
6+
{NULL},
7+
};
8+
9+
int
10+
_PyTestCapi_Init_ByteArray(PyObject *m)
11+
{
12+
if (PyModule_AddFunctions(m, test_methods) < 0) {
13+
return -1;
14+
}
15+
16+
return 0;
17+
}

Modules/_testcapi/bytes.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
5+
static PyMethodDef test_methods[] = {
6+
{NULL},
7+
};
8+
9+
int
10+
_PyTestCapi_Init_Bytes(PyObject *m)
11+
{
12+
if (PyModule_AddFunctions(m, test_methods) < 0) {
13+
return -1;
14+
}
15+
16+
return 0;
17+
}

Modules/_testcapi/codec.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
5+
static PyMethodDef test_methods[] = {
6+
{NULL},
7+
};
8+
9+
int
10+
_PyTestCapi_Init_Codec(PyObject *m)
11+
{
12+
if (PyModule_AddFunctions(m, test_methods) < 0){
13+
return -1;
14+
}
15+
16+
return 0;
17+
}

Modules/_testcapi/complex.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
static PyMethodDef test_methods[] = {
5+
{NULL},
6+
};
7+
8+
int
9+
_PyTestCapi_Init_Complex(PyObject *mod)
10+
{
11+
if (PyModule_AddFunctions(mod, test_methods) < 0) {
12+
return -1;
13+
}
14+
15+
return 0;
16+
}

Modules/_testcapi/file.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
5+
static PyMethodDef test_methods[] = {
6+
{NULL},
7+
};
8+
9+
int
10+
_PyTestCapi_Init_File(PyObject *m)
11+
{
12+
if (PyModule_AddFunctions(m, test_methods) < 0){
13+
return -1;
14+
}
15+
16+
return 0;
17+
}

Modules/_testcapi/list.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
5+
static PyMethodDef test_methods[] = {
6+
{NULL},
7+
};
8+
9+
int
10+
_PyTestCapi_Init_List(PyObject *m)
11+
{
12+
if (PyModule_AddFunctions(m, test_methods) < 0){
13+
return -1;
14+
}
15+
16+
return 0;
17+
}

Modules/_testcapi/numbers.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
static PyMethodDef test_methods[] = {
5+
{NULL},
6+
};
7+
8+
int
9+
_PyTestCapi_Init_Numbers(PyObject *mod)
10+
{
11+
if (PyModule_AddFunctions(mod, test_methods) < 0) {
12+
return -1;
13+
}
14+
15+
return 0;
16+
}

Modules/_testcapi/parts.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
int _PyTestCapi_Init_Vectorcall(PyObject *module);
2828
int _PyTestCapi_Init_Heaptype(PyObject *module);
2929
int _PyTestCapi_Init_Abstract(PyObject *module);
30+
int _PyTestCapi_Init_ByteArray(PyObject *module);
31+
int _PyTestCapi_Init_Bytes(PyObject *module);
3032
int _PyTestCapi_Init_Unicode(PyObject *module);
3133
int _PyTestCapi_Init_GetArgs(PyObject *module);
3234
int _PyTestCapi_Init_PyTime(PyObject *module);
@@ -36,16 +38,22 @@ int _PyTestCapi_Init_Mem(PyObject *module);
3638
int _PyTestCapi_Init_Watchers(PyObject *module);
3739
int _PyTestCapi_Init_Long(PyObject *module);
3840
int _PyTestCapi_Init_Float(PyObject *module);
41+
int _PyTestCapi_Init_Complex(PyObject *module);
42+
int _PyTestCapi_Init_Numbers(PyObject *module);
3943
int _PyTestCapi_Init_Dict(PyObject *module);
4044
int _PyTestCapi_Init_Set(PyObject *module);
45+
int _PyTestCapi_Init_List(PyObject *module);
46+
int _PyTestCapi_Init_Tuple(PyObject *module);
4147
int _PyTestCapi_Init_Structmember(PyObject *module);
4248
int _PyTestCapi_Init_Exceptions(PyObject *module);
4349
int _PyTestCapi_Init_Code(PyObject *module);
4450
int _PyTestCapi_Init_Buffer(PyObject *module);
4551
int _PyTestCapi_Init_PyOS(PyObject *module);
52+
int _PyTestCapi_Init_File(PyObject *module);
53+
int _PyTestCapi_Init_Codec(PyObject *module);
4654
int _PyTestCapi_Init_Immortal(PyObject *module);
47-
int _PyTestCapi_Init_GC(PyObject *mod);
48-
int _PyTestCapi_Init_Sys(PyObject *);
55+
int _PyTestCapi_Init_GC(PyObject *module);
56+
int _PyTestCapi_Init_Sys(PyObject *module);
4957

5058
#ifdef LIMITED_API_AVAILABLE
5159
int _PyTestCapi_Init_VectorcallLimited(PyObject *module);

Modules/_testcapi/tuple.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "parts.h"
2+
#include "util.h"
3+
4+
5+
static PyMethodDef test_methods[] = {
6+
{NULL},
7+
};
8+
9+
int
10+
_PyTestCapi_Init_Tuple(PyObject *m)
11+
{
12+
if (PyModule_AddFunctions(m, test_methods) < 0){
13+
return -1;
14+
}
15+
16+
return 0;
17+
}

0 commit comments

Comments
 (0)