You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.1 KiB

  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. static struct PyModuleDef _testimportmultiple = {
  8. PyModuleDef_HEAD_INIT,
  9. "_testimportmultiple",
  10. "_testimportmultiple doc",
  11. -1,
  12. NULL,
  13. NULL,
  14. NULL,
  15. NULL,
  16. NULL
  17. };
  18. PyMODINIT_FUNC PyInit__testimportmultiple(void)
  19. {
  20. return PyModule_Create(&_testimportmultiple);
  21. }
  22. static struct PyModuleDef _foomodule = {
  23. PyModuleDef_HEAD_INIT,
  24. "_testimportmultiple_foo",
  25. "_testimportmultiple_foo doc",
  26. -1,
  27. NULL,
  28. NULL,
  29. NULL,
  30. NULL,
  31. NULL
  32. };
  33. PyMODINIT_FUNC PyInit__testimportmultiple_foo(void)
  34. {
  35. return PyModule_Create(&_foomodule);
  36. }
  37. static struct PyModuleDef _barmodule = {
  38. PyModuleDef_HEAD_INIT,
  39. "_testimportmultiple_bar",
  40. "_testimportmultiple_bar doc",
  41. -1,
  42. NULL,
  43. NULL,
  44. NULL,
  45. NULL,
  46. NULL
  47. };
  48. PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){
  49. return PyModule_Create(&_barmodule);
  50. }