2024-03-07 18:31:12 +00:00
|
|
|
/*
|
|
|
|
* Test the limited C API.
|
|
|
|
*
|
|
|
|
* The 'test_*' functions exported by this module are run as part of the
|
|
|
|
* standard Python regression test, via Lib/test/test_capi.py.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "_testlimitedcapi/parts.h"
|
|
|
|
|
|
|
|
static PyMethodDef TestMethods[] = {
|
|
|
|
{NULL, NULL} /* sentinel */
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct PyModuleDef _testlimitedcapimodule = {
|
|
|
|
PyModuleDef_HEAD_INIT,
|
|
|
|
.m_name = "_testlimitedcapi",
|
|
|
|
.m_size = 0,
|
|
|
|
.m_methods = TestMethods,
|
|
|
|
};
|
|
|
|
|
|
|
|
PyMODINIT_FUNC
|
|
|
|
PyInit__testlimitedcapi(void)
|
|
|
|
{
|
|
|
|
PyObject *mod = PyModule_Create(&_testlimitedcapimodule);
|
|
|
|
if (mod == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-05-03 15:30:55 +00:00
|
|
|
#ifdef Py_GIL_DISABLED
|
2024-05-06 16:59:36 +00:00
|
|
|
PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
|
2024-05-03 15:30:55 +00:00
|
|
|
#endif
|
2024-03-07 18:31:12 +00:00
|
|
|
|
2024-03-19 10:44:13 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Abstract(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_ByteArray(mod) < 0) {
|
2024-03-11 10:28:16 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Bytes(mod) < 0) {
|
2024-03-07 18:31:12 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-09-29 15:22:39 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Codec(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-19 16:23:12 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Complex(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-19 15:06:20 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Dict(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-08-08 12:16:20 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Eval(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-19 10:44:13 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Float(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_HeaptypeRelative(mod) < 0) {
|
2024-03-07 18:31:12 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_List(mod) < 0) {
|
2024-03-18 21:03:55 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-19 14:04:23 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Long(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-21 16:07:00 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Object(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_PyOS(mod) < 0) {
|
2024-03-11 10:28:16 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Set(mod) < 0) {
|
2024-03-18 21:03:55 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Sys(mod) < 0) {
|
2024-03-11 10:28:16 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-08-26 09:57:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Tuple(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-19 12:30:39 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_Unicode(mod) < 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-18 22:06:52 +00:00
|
|
|
if (_PyTestLimitedCAPI_Init_VectorcallLimited(mod) < 0) {
|
2024-03-11 10:28:16 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2024-03-07 18:31:12 +00:00
|
|
|
return mod;
|
|
|
|
}
|