• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * C Extension module to test Python internal C APIs (Include/internal).
3  */
4 
5 #if !defined(Py_BUILD_CORE_BUILTIN) && !defined(Py_BUILD_CORE_MODULE)
6 #  error "Py_BUILD_CORE_BUILTIN or Py_BUILD_CORE_MODULE must be defined"
7 #endif
8 
9 #define PY_SSIZE_T_CLEAN
10 
11 #include "Python.h"
12 #include "pycore_initconfig.h"
13 
14 
15 static PyObject *
get_configs(PyObject * self,PyObject * Py_UNUSED (args))16 get_configs(PyObject *self, PyObject *Py_UNUSED(args))
17 {
18     return _Py_GetConfigsAsDict();
19 }
20 
21 
22 static PyMethodDef TestMethods[] = {
23     {"get_configs", get_configs, METH_NOARGS},
24     {NULL, NULL} /* sentinel */
25 };
26 
27 
28 static struct PyModuleDef _testcapimodule = {
29     PyModuleDef_HEAD_INIT,
30     "_testinternalcapi",
31     NULL,
32     -1,
33     TestMethods,
34     NULL,
35     NULL,
36     NULL,
37     NULL
38 };
39 
40 
41 PyMODINIT_FUNC
PyInit__testinternalcapi(void)42 PyInit__testinternalcapi(void)
43 {
44     return PyModule_Create(&_testcapimodule);
45 }
46