mirror of
https://github.com/python/cpython.git
synced 2024-11-24 02:15:30 +08:00
d9bcdda39c
Add a new C extension "_testlimitedcapi" which is only built with the limited C API. Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/. * configure: add _testlimitedcapi test extension. * Update generate_stdlib_module_names.py. * Update make check-c-globals. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
37 lines
790 B
C
37 lines
790 B
C
/*
|
|
* 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;
|
|
}
|
|
|
|
if (_PyTestCapi_Init_VectorcallLimited(mod) < 0) {
|
|
return NULL;
|
|
}
|
|
if (_PyTestCapi_Init_HeaptypeRelative(mod) < 0) {
|
|
return NULL;
|
|
}
|
|
return mod;
|
|
}
|