1 /* 2 * C extensions module to test importing multiple modules from one compiled 3 * file (issue16421). This file defines 3 modules (_testimportmodule, 4 * foo, bar), only the first one is called the same as the compiled file. 5 */ 6 #include<Python.h> 7 8 static struct PyModuleDef _testimportmultiple = { 9 PyModuleDef_HEAD_INIT, 10 "_testimportmultiple", 11 "_testimportmultiple doc", 12 -1, 13 NULL, 14 NULL, 15 NULL, 16 NULL, 17 NULL 18 }; 19 20 PyMODINIT_FUNC PyInit__testimportmultiple(void) 21 { 22 return PyModule_Create(&_testimportmultiple); 23 } 24 25 static struct PyModuleDef _foomodule = { 26 PyModuleDef_HEAD_INIT, 27 "_testimportmultiple_foo", 28 "_testimportmultiple_foo doc", 29 -1, 30 NULL, 31 NULL, 32 NULL, 33 NULL, 34 NULL 35 }; 36 37 PyMODINIT_FUNC PyInit__testimportmultiple_foo(void) 38 { 39 return PyModule_Create(&_foomodule); 40 } 41 42 static struct PyModuleDef _barmodule = { 43 PyModuleDef_HEAD_INIT, 44 "_testimportmultiple_bar", 45 "_testimportmultiple_bar doc", 46 -1, 47 NULL, 48 NULL, 49 NULL, 50 NULL, 51 NULL 52 }; 53 54 PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){ 55 return PyModule_Create(&_barmodule); 56 } 57 58