Mercurial > cpython-lru_cache-weakref
annotate Modules/_testimportmultiple.c @ 81343:3a7cd8efc19f
#16852: merge with 3.3.
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Thu, 10 Jan 2013 03:29:45 +0200 |
| parents | 16b1fde2275c |
| children |
| rev | line source |
|---|---|
|
80842
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
1 /* |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
2 * C extensions module to test importing multiple modules from one compiled |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
3 * file (issue16421). This file defines 3 modules (_testimportmodule, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
4 * foo, bar), only the first one is called the same as the compiled file. |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
5 */ |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
6 #include<Python.h> |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
7 |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
8 static struct PyModuleDef _testimportmultiple = { |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
9 PyModuleDef_HEAD_INIT, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
10 "_testimportmultiple", |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
11 "_testimportmultiple doc", |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
12 -1, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
13 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
14 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
15 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
16 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
17 NULL |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
18 }; |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
19 |
|
80856
16b1fde2275c
Remove compile warnings for _testimportmodule
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80855
diff
changeset
|
20 PyMODINIT_FUNC PyInit__testimportmultiple(void) |
|
80842
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
21 { |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
22 return PyModule_Create(&_testimportmultiple); |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
23 } |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
24 |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
25 static struct PyModuleDef _foomodule = { |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
26 PyModuleDef_HEAD_INIT, |
|
80855
2e492a9a1845
Rename test module names for #16421 to don't clash with other tests.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80842
diff
changeset
|
27 "_testimportmultiple_foo", |
|
2e492a9a1845
Rename test module names for #16421 to don't clash with other tests.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80842
diff
changeset
|
28 "_testimportmultiple_foo doc", |
|
80842
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
29 -1, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
30 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
31 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
32 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
33 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
34 NULL |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
35 }; |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
36 |
|
80856
16b1fde2275c
Remove compile warnings for _testimportmodule
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80855
diff
changeset
|
37 PyMODINIT_FUNC PyInit__testimportmultiple_foo(void) |
|
80842
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
38 { |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
39 return PyModule_Create(&_foomodule); |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
40 } |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
41 |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
42 static struct PyModuleDef _barmodule = { |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
43 PyModuleDef_HEAD_INIT, |
|
80855
2e492a9a1845
Rename test module names for #16421 to don't clash with other tests.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80842
diff
changeset
|
44 "_testimportmultiple_bar", |
|
2e492a9a1845
Rename test module names for #16421 to don't clash with other tests.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80842
diff
changeset
|
45 "_testimportmultiple_bar doc", |
|
80842
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
46 -1, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
47 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
48 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
49 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
50 NULL, |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
51 NULL |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
52 }; |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
53 |
|
80856
16b1fde2275c
Remove compile warnings for _testimportmodule
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
80855
diff
changeset
|
54 PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){ |
|
80842
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
55 return PyModule_Create(&_barmodule); |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
56 } |
|
6eefe4d537b3
Issue #16421: allow to load multiple modules from the same shared object.
Andrew Svetlov <andrew.svetlov@gmail.com>
parents:
diff
changeset
|
57 |
