blob: 1caeb66eb8c85890e2105e3b40716572bf7a5c78 [file] [log] [blame]
Andrew Svetlov6b2cbeb2012-12-14 17:04:59 +02001/*
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
8static 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
Andrew Svetlov1a714752012-12-15 18:16:47 +020020PyMODINIT_FUNC PyInit__testimportmultiple(void)
Andrew Svetlov6b2cbeb2012-12-14 17:04:59 +020021{
22 return PyModule_Create(&_testimportmultiple);
23}
24
25static struct PyModuleDef _foomodule = {
26 PyModuleDef_HEAD_INIT,
Andrew Svetlovef9a43b2012-12-15 17:22:59 +020027 "_testimportmultiple_foo",
28 "_testimportmultiple_foo doc",
Andrew Svetlov6b2cbeb2012-12-14 17:04:59 +020029 -1,
30 NULL,
31 NULL,
32 NULL,
33 NULL,
34 NULL
35};
36
Andrew Svetlov1a714752012-12-15 18:16:47 +020037PyMODINIT_FUNC PyInit__testimportmultiple_foo(void)
Andrew Svetlov6b2cbeb2012-12-14 17:04:59 +020038{
39 return PyModule_Create(&_foomodule);
40}
41
42static struct PyModuleDef _barmodule = {
43 PyModuleDef_HEAD_INIT,
Andrew Svetlovef9a43b2012-12-15 17:22:59 +020044 "_testimportmultiple_bar",
45 "_testimportmultiple_bar doc",
Andrew Svetlov6b2cbeb2012-12-14 17:04:59 +020046 -1,
47 NULL,
48 NULL,
49 NULL,
50 NULL,
51 NULL
52};
53
Andrew Svetlov1a714752012-12-15 18:16:47 +020054PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){
Andrew Svetlov6b2cbeb2012-12-14 17:04:59 +020055 return PyModule_Create(&_barmodule);
56}
57