blob: 4933abbabbe307e6178df2db7df8100d22439aec [file] [log] [blame]
Nick Coghland5cacbb2015-05-23 22:24:10 +10001
2/* Testing module for multi-phase initialization of extension modules (PEP 489)
3 */
4
5#include "Python.h"
6
7/* Example objects */
8typedef struct {
9 PyObject_HEAD
10 PyObject *x_attr; /* Attributes dictionary */
11} ExampleObject;
12
Marcel Plchc2b0b122018-03-17 06:41:20 +010013typedef struct {
14 PyObject *integer;
15} testmultiphase_state;
16
Nick Coghland5cacbb2015-05-23 22:24:10 +100017/* Example methods */
18
Nick Coghlan53f95022015-06-04 21:52:57 +100019static int
20Example_traverse(ExampleObject *self, visitproc visit, void *arg)
Nick Coghland5cacbb2015-05-23 22:24:10 +100021{
Nick Coghlan53f95022015-06-04 21:52:57 +100022 Py_VISIT(self->x_attr);
23 return 0;
24}
25
Serhiy Storchaka19de8b32018-05-26 10:51:58 +030026static void
Nick Coghlan53f95022015-06-04 21:52:57 +100027Example_finalize(ExampleObject *self)
28{
29 Py_CLEAR(self->x_attr);
Nick Coghland5cacbb2015-05-23 22:24:10 +100030}
31
32static PyObject *
33Example_demo(ExampleObject *self, PyObject *args)
34{
35 PyObject *o = NULL;
36 if (!PyArg_ParseTuple(args, "|O:demo", &o))
37 return NULL;
38 if (o != NULL && PyUnicode_Check(o)) {
39 Py_INCREF(o);
40 return o;
41 }
Serhiy Storchaka228b12e2017-01-23 09:47:21 +020042 Py_RETURN_NONE;
Nick Coghland5cacbb2015-05-23 22:24:10 +100043}
44
45
46static PyMethodDef Example_methods[] = {
47 {"demo", (PyCFunction)Example_demo, METH_VARARGS,
48 PyDoc_STR("demo() -> None")},
49 {NULL, NULL} /* sentinel */
50};
51
52static PyObject *
53Example_getattro(ExampleObject *self, PyObject *name)
54{
55 if (self->x_attr != NULL) {
Serhiy Storchakaa24107b2019-02-25 17:59:46 +020056 PyObject *v = PyDict_GetItemWithError(self->x_attr, name);
Nick Coghland5cacbb2015-05-23 22:24:10 +100057 if (v != NULL) {
58 Py_INCREF(v);
59 return v;
60 }
Serhiy Storchakaa24107b2019-02-25 17:59:46 +020061 else if (PyErr_Occurred()) {
62 return NULL;
63 }
Nick Coghland5cacbb2015-05-23 22:24:10 +100064 }
65 return PyObject_GenericGetAttr((PyObject *)self, name);
66}
67
68static int
Serhiy Storchakaef1585e2015-12-25 20:01:53 +020069Example_setattr(ExampleObject *self, const char *name, PyObject *v)
Nick Coghland5cacbb2015-05-23 22:24:10 +100070{
71 if (self->x_attr == NULL) {
72 self->x_attr = PyDict_New();
73 if (self->x_attr == NULL)
74 return -1;
75 }
76 if (v == NULL) {
77 int rv = PyDict_DelItemString(self->x_attr, name);
Serhiy Storchakaa24107b2019-02-25 17:59:46 +020078 if (rv < 0 && PyErr_ExceptionMatches(PyExc_KeyError))
Nick Coghland5cacbb2015-05-23 22:24:10 +100079 PyErr_SetString(PyExc_AttributeError,
80 "delete non-existing Example attribute");
81 return rv;
82 }
83 else
84 return PyDict_SetItemString(self->x_attr, name, v);
85}
86
87static PyType_Slot Example_Type_slots[] = {
88 {Py_tp_doc, "The Example type"},
Nick Coghlan53f95022015-06-04 21:52:57 +100089 {Py_tp_finalize, Example_finalize},
90 {Py_tp_traverse, Example_traverse},
Nick Coghland5cacbb2015-05-23 22:24:10 +100091 {Py_tp_getattro, Example_getattro},
92 {Py_tp_setattr, Example_setattr},
93 {Py_tp_methods, Example_methods},
94 {0, 0},
95};
96
97static PyType_Spec Example_Type_spec = {
98 "_testimportexec.Example",
99 sizeof(ExampleObject),
100 0,
Antoine Pitrouada319b2019-05-29 22:12:38 +0200101 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
Nick Coghland5cacbb2015-05-23 22:24:10 +1000102 Example_Type_slots
103};
104
105/* Function of two integers returning integer */
106
107PyDoc_STRVAR(testexport_foo_doc,
108"foo(i,j)\n\
109\n\
110Return the sum of i and j.");
111
112static PyObject *
113testexport_foo(PyObject *self, PyObject *args)
114{
115 long i, j;
116 long res;
117 if (!PyArg_ParseTuple(args, "ll:foo", &i, &j))
118 return NULL;
119 res = i + j;
120 return PyLong_FromLong(res);
121}
122
123/* Test that PyState registration fails */
124
125PyDoc_STRVAR(call_state_registration_func_doc,
126"register_state(0): call PyState_FindModule()\n\
127register_state(1): call PyState_AddModule()\n\
128register_state(2): call PyState_RemoveModule()");
129
130static PyObject *
131call_state_registration_func(PyObject *mod, PyObject *args)
132{
133 int i, ret;
134 PyModuleDef *def = PyModule_GetDef(mod);
135 if (def == NULL) {
136 return NULL;
137 }
138 if (!PyArg_ParseTuple(args, "i:call_state_registration_func", &i))
139 return NULL;
140 switch (i) {
141 case 0:
142 mod = PyState_FindModule(def);
143 if (mod == NULL) {
144 Py_RETURN_NONE;
145 }
146 return mod;
147 case 1:
148 ret = PyState_AddModule(mod, def);
149 if (ret != 0) {
150 return NULL;
151 }
152 break;
153 case 2:
154 ret = PyState_RemoveModule(def);
155 if (ret != 0) {
156 return NULL;
157 }
158 break;
159 }
160 Py_RETURN_NONE;
161}
162
163
164static PyType_Slot Str_Type_slots[] = {
165 {Py_tp_base, NULL}, /* filled out in module exec function */
166 {0, 0},
167};
168
169static PyType_Spec Str_Type_spec = {
170 "_testimportexec.Str",
171 0,
172 0,
173 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
174 Str_Type_slots
175};
176
177static PyMethodDef testexport_methods[] = {
178 {"foo", testexport_foo, METH_VARARGS,
179 testexport_foo_doc},
180 {"call_state_registration_func", call_state_registration_func,
181 METH_VARARGS, call_state_registration_func_doc},
182 {NULL, NULL} /* sentinel */
183};
184
185static int execfunc(PyObject *m)
186{
187 PyObject *temp = NULL;
188
189 /* Due to cross platform compiler issues the slots must be filled
190 * here. It's required for portability to Windows without requiring
191 * C++. */
192 Str_Type_slots[0].pfunc = &PyUnicode_Type;
193
194 /* Add a custom type */
195 temp = PyType_FromSpec(&Example_Type_spec);
196 if (temp == NULL)
197 goto fail;
198 if (PyModule_AddObject(m, "Example", temp) != 0)
199 goto fail;
200
201 /* Add an exception type */
202 temp = PyErr_NewException("_testimportexec.error", NULL, NULL);
203 if (temp == NULL)
204 goto fail;
205 if (PyModule_AddObject(m, "error", temp) != 0)
206 goto fail;
207
208 /* Add Str */
209 temp = PyType_FromSpec(&Str_Type_spec);
210 if (temp == NULL)
211 goto fail;
212 if (PyModule_AddObject(m, "Str", temp) != 0)
213 goto fail;
214
215 if (PyModule_AddIntConstant(m, "int_const", 1969) != 0)
216 goto fail;
217
218 if (PyModule_AddStringConstant(m, "str_const", "something different") != 0)
219 goto fail;
220
221 return 0;
222 fail:
223 return -1;
224}
225
226/* Helper for module definitions; there'll be a lot of them */
Marcel Plchc2b0b122018-03-17 06:41:20 +0100227
228#define TEST_MODULE_DEF_EX(name, slots, methods, statesize, traversefunc) { \
Nick Coghland5cacbb2015-05-23 22:24:10 +1000229 PyModuleDef_HEAD_INIT, /* m_base */ \
230 name, /* m_name */ \
231 PyDoc_STR("Test module " name), /* m_doc */ \
Marcel Plchc2b0b122018-03-17 06:41:20 +0100232 statesize, /* m_size */ \
Nick Coghland5cacbb2015-05-23 22:24:10 +1000233 methods, /* m_methods */ \
234 slots, /* m_slots */ \
Marcel Plchc2b0b122018-03-17 06:41:20 +0100235 traversefunc, /* m_traverse */ \
Nick Coghland5cacbb2015-05-23 22:24:10 +1000236 NULL, /* m_clear */ \
237 NULL, /* m_free */ \
238}
239
Marcel Plchc2b0b122018-03-17 06:41:20 +0100240#define TEST_MODULE_DEF(name, slots, methods) TEST_MODULE_DEF_EX(name, slots, methods, 0, NULL)
241
Benjamin Petersoncb4bae72018-07-06 21:05:51 -0700242static PyModuleDef_Slot main_slots[] = {
Nick Coghland5cacbb2015-05-23 22:24:10 +1000243 {Py_mod_exec, execfunc},
244 {0, NULL},
245};
246
247static PyModuleDef main_def = TEST_MODULE_DEF("main", main_slots, testexport_methods);
248
249PyMODINIT_FUNC
250PyInit__testmultiphase(PyObject *spec)
251{
252 return PyModuleDef_Init(&main_def);
253}
254
255
256/**** Importing a non-module object ****/
257
258static PyModuleDef def_nonmodule;
Nick Coghlan8682f572016-08-21 17:41:56 +1000259static PyModuleDef def_nonmodule_with_methods;
Nick Coghland5cacbb2015-05-23 22:24:10 +1000260
261/* Create a SimpleNamespace(three=3) */
262static PyObject*
263createfunc_nonmodule(PyObject *spec, PyModuleDef *def)
264{
265 PyObject *dct, *ns, *three;
266
Nick Coghlan8682f572016-08-21 17:41:56 +1000267 if (def != &def_nonmodule && def != &def_nonmodule_with_methods) {
Nick Coghland5cacbb2015-05-23 22:24:10 +1000268 PyErr_SetString(PyExc_SystemError, "def does not match");
269 return NULL;
270 }
271
272 dct = PyDict_New();
273 if (dct == NULL)
274 return NULL;
275
276 three = PyLong_FromLong(3);
277 if (three == NULL) {
278 Py_DECREF(dct);
279 return NULL;
280 }
281 PyDict_SetItemString(dct, "three", three);
Nick Coghlana48db2b2015-05-24 01:03:46 +1000282 Py_DECREF(three);
Nick Coghland5cacbb2015-05-23 22:24:10 +1000283
284 ns = _PyNamespace_New(dct);
285 Py_DECREF(dct);
286 return ns;
287}
288
289static PyModuleDef_Slot slots_create_nonmodule[] = {
290 {Py_mod_create, createfunc_nonmodule},
291 {0, NULL},
292};
293
294static PyModuleDef def_nonmodule = TEST_MODULE_DEF(
295 "_testmultiphase_nonmodule", slots_create_nonmodule, NULL);
296
297PyMODINIT_FUNC
298PyInit__testmultiphase_nonmodule(PyObject *spec)
299{
300 return PyModuleDef_Init(&def_nonmodule);
301}
302
Nick Coghlan8682f572016-08-21 17:41:56 +1000303PyDoc_STRVAR(nonmodule_bar_doc,
304"bar(i,j)\n\
305\n\
306Return the difference of i - j.");
307
308static PyObject *
309nonmodule_bar(PyObject *self, PyObject *args)
310{
311 long i, j;
312 long res;
313 if (!PyArg_ParseTuple(args, "ll:bar", &i, &j))
314 return NULL;
315 res = i - j;
316 return PyLong_FromLong(res);
317}
318
319static PyMethodDef nonmodule_methods[] = {
320 {"bar", nonmodule_bar, METH_VARARGS, nonmodule_bar_doc},
321 {NULL, NULL} /* sentinel */
322};
323
324static PyModuleDef def_nonmodule_with_methods = TEST_MODULE_DEF(
325 "_testmultiphase_nonmodule_with_methods", slots_create_nonmodule, nonmodule_methods);
326
327PyMODINIT_FUNC
328PyInit__testmultiphase_nonmodule_with_methods(PyObject *spec)
329{
330 return PyModuleDef_Init(&def_nonmodule_with_methods);
331}
332
Nick Coghland5cacbb2015-05-23 22:24:10 +1000333/**** Non-ASCII-named modules ****/
334
335static PyModuleDef def_nonascii_latin = { \
336 PyModuleDef_HEAD_INIT, /* m_base */
337 "_testmultiphase_nonascii_latin", /* m_name */
338 PyDoc_STR("Module named in Czech"), /* m_doc */
339 0, /* m_size */
340 NULL, /* m_methods */
341 NULL, /* m_slots */
342 NULL, /* m_traverse */
343 NULL, /* m_clear */
344 NULL, /* m_free */
345};
346
347PyMODINIT_FUNC
348PyInitU__testmultiphase_zkouka_naten_evc07gi8e(PyObject *spec)
349{
350 return PyModuleDef_Init(&def_nonascii_latin);
351}
352
353static PyModuleDef def_nonascii_kana = { \
354 PyModuleDef_HEAD_INIT, /* m_base */
355 "_testmultiphase_nonascii_kana", /* m_name */
356 PyDoc_STR("Module named in Japanese"), /* m_doc */
357 0, /* m_size */
358 NULL, /* m_methods */
359 NULL, /* m_slots */
360 NULL, /* m_traverse */
361 NULL, /* m_clear */
362 NULL, /* m_free */
363};
364
365PyMODINIT_FUNC
366PyInitU_eckzbwbhc6jpgzcx415x(PyObject *spec)
367{
368 return PyModuleDef_Init(&def_nonascii_kana);
369}
370
Benjamin Petersone20056c2015-05-29 17:10:30 -0500371/*** Module with a single-character name ***/
372
373PyMODINIT_FUNC
374PyInit_x(PyObject *spec)
375{
376 return PyModuleDef_Init(&main_def);
377}
378
Nick Coghland5cacbb2015-05-23 22:24:10 +1000379/**** Testing NULL slots ****/
380
381static PyModuleDef null_slots_def = TEST_MODULE_DEF(
382 "_testmultiphase_null_slots", NULL, NULL);
383
384PyMODINIT_FUNC
385PyInit__testmultiphase_null_slots(PyObject *spec)
386{
387 return PyModuleDef_Init(&null_slots_def);
388}
389
390/**** Problematic modules ****/
391
392static PyModuleDef_Slot slots_bad_large[] = {
393 {_Py_mod_LAST_SLOT + 1, NULL},
394 {0, NULL},
395};
396
397static PyModuleDef def_bad_large = TEST_MODULE_DEF(
398 "_testmultiphase_bad_slot_large", slots_bad_large, NULL);
399
400PyMODINIT_FUNC
401PyInit__testmultiphase_bad_slot_large(PyObject *spec)
402{
403 return PyModuleDef_Init(&def_bad_large);
404}
405
406static PyModuleDef_Slot slots_bad_negative[] = {
407 {-1, NULL},
408 {0, NULL},
409};
410
411static PyModuleDef def_bad_negative = TEST_MODULE_DEF(
412 "_testmultiphase_bad_slot_negative", slots_bad_negative, NULL);
413
414PyMODINIT_FUNC
415PyInit__testmultiphase_bad_slot_negative(PyObject *spec)
416{
417 return PyModuleDef_Init(&def_bad_negative);
418}
419
420static PyModuleDef def_create_int_with_state = { \
421 PyModuleDef_HEAD_INIT, /* m_base */
422 "create_with_state", /* m_name */
423 PyDoc_STR("Not a PyModuleObject object, but requests per-module state"),
424 10, /* m_size */
425 NULL, /* m_methods */
426 slots_create_nonmodule, /* m_slots */
427 NULL, /* m_traverse */
428 NULL, /* m_clear */
429 NULL, /* m_free */
430};
431
432PyMODINIT_FUNC
433PyInit__testmultiphase_create_int_with_state(PyObject *spec)
434{
435 return PyModuleDef_Init(&def_create_int_with_state);
436}
437
438
439static PyModuleDef def_negative_size = { \
440 PyModuleDef_HEAD_INIT, /* m_base */
441 "negative_size", /* m_name */
442 PyDoc_STR("PyModuleDef with negative m_size"),
443 -1, /* m_size */
444 NULL, /* m_methods */
445 slots_create_nonmodule, /* m_slots */
446 NULL, /* m_traverse */
447 NULL, /* m_clear */
448 NULL, /* m_free */
449};
450
451PyMODINIT_FUNC
452PyInit__testmultiphase_negative_size(PyObject *spec)
453{
454 return PyModuleDef_Init(&def_negative_size);
455}
456
457
458static PyModuleDef uninitialized_def = TEST_MODULE_DEF("main", main_slots, testexport_methods);
459
460PyMODINIT_FUNC
461PyInit__testmultiphase_export_uninitialized(PyObject *spec)
462{
463 return (PyObject*) &uninitialized_def;
464}
465
466PyMODINIT_FUNC
467PyInit__testmultiphase_export_null(PyObject *spec)
468{
469 return NULL;
470}
471
472PyMODINIT_FUNC
473PyInit__testmultiphase_export_raise(PyObject *spec)
474{
475 PyErr_SetString(PyExc_SystemError, "bad export function");
476 return NULL;
477}
478
479PyMODINIT_FUNC
480PyInit__testmultiphase_export_unreported_exception(PyObject *spec)
481{
482 PyErr_SetString(PyExc_SystemError, "bad export function");
483 return PyModuleDef_Init(&main_def);
484}
485
486static PyObject*
487createfunc_null(PyObject *spec, PyModuleDef *def)
488{
489 return NULL;
490}
491
Benjamin Petersoncb4bae72018-07-06 21:05:51 -0700492static PyModuleDef_Slot slots_create_null[] = {
Nick Coghland5cacbb2015-05-23 22:24:10 +1000493 {Py_mod_create, createfunc_null},
494 {0, NULL},
495};
496
497static PyModuleDef def_create_null = TEST_MODULE_DEF(
498 "_testmultiphase_create_null", slots_create_null, NULL);
499
500PyMODINIT_FUNC
501PyInit__testmultiphase_create_null(PyObject *spec)
502{
503 return PyModuleDef_Init(&def_create_null);
504}
505
506static PyObject*
507createfunc_raise(PyObject *spec, PyModuleDef *def)
508{
509 PyErr_SetString(PyExc_SystemError, "bad create function");
510 return NULL;
511}
512
513static PyModuleDef_Slot slots_create_raise[] = {
514 {Py_mod_create, createfunc_raise},
515 {0, NULL},
516};
517
518static PyModuleDef def_create_raise = TEST_MODULE_DEF(
519 "_testmultiphase_create_null", slots_create_raise, NULL);
520
521PyMODINIT_FUNC
522PyInit__testmultiphase_create_raise(PyObject *spec)
523{
524 return PyModuleDef_Init(&def_create_raise);
525}
526
527static PyObject*
528createfunc_unreported_exception(PyObject *spec, PyModuleDef *def)
529{
530 PyErr_SetString(PyExc_SystemError, "bad create function");
531 return PyModule_New("foo");
532}
533
534static PyModuleDef_Slot slots_create_unreported_exception[] = {
535 {Py_mod_create, createfunc_unreported_exception},
536 {0, NULL},
537};
538
539static PyModuleDef def_create_unreported_exception = TEST_MODULE_DEF(
540 "_testmultiphase_create_unreported_exception", slots_create_unreported_exception, NULL);
541
542PyMODINIT_FUNC
543PyInit__testmultiphase_create_unreported_exception(PyObject *spec)
544{
545 return PyModuleDef_Init(&def_create_unreported_exception);
546}
547
548static PyModuleDef_Slot slots_nonmodule_with_exec_slots[] = {
549 {Py_mod_create, createfunc_nonmodule},
550 {Py_mod_exec, execfunc},
551 {0, NULL},
552};
553
554static PyModuleDef def_nonmodule_with_exec_slots = TEST_MODULE_DEF(
555 "_testmultiphase_nonmodule_with_exec_slots", slots_nonmodule_with_exec_slots, NULL);
556
557PyMODINIT_FUNC
558PyInit__testmultiphase_nonmodule_with_exec_slots(PyObject *spec)
559{
560 return PyModuleDef_Init(&def_nonmodule_with_exec_slots);
561}
562
563static int
564execfunc_err(PyObject *mod)
565{
566 return -1;
567}
568
569static PyModuleDef_Slot slots_exec_err[] = {
570 {Py_mod_exec, execfunc_err},
571 {0, NULL},
572};
573
574static PyModuleDef def_exec_err = TEST_MODULE_DEF(
575 "_testmultiphase_exec_err", slots_exec_err, NULL);
576
577PyMODINIT_FUNC
578PyInit__testmultiphase_exec_err(PyObject *spec)
579{
580 return PyModuleDef_Init(&def_exec_err);
581}
582
583static int
584execfunc_raise(PyObject *spec)
585{
586 PyErr_SetString(PyExc_SystemError, "bad exec function");
587 return -1;
588}
589
590static PyModuleDef_Slot slots_exec_raise[] = {
591 {Py_mod_exec, execfunc_raise},
592 {0, NULL},
593};
594
595static PyModuleDef def_exec_raise = TEST_MODULE_DEF(
596 "_testmultiphase_exec_raise", slots_exec_raise, NULL);
597
598PyMODINIT_FUNC
599PyInit__testmultiphase_exec_raise(PyObject *mod)
600{
601 return PyModuleDef_Init(&def_exec_raise);
602}
603
604static int
605execfunc_unreported_exception(PyObject *mod)
606{
607 PyErr_SetString(PyExc_SystemError, "bad exec function");
608 return 0;
609}
610
611static PyModuleDef_Slot slots_exec_unreported_exception[] = {
612 {Py_mod_exec, execfunc_unreported_exception},
613 {0, NULL},
614};
615
616static PyModuleDef def_exec_unreported_exception = TEST_MODULE_DEF(
617 "_testmultiphase_exec_unreported_exception", slots_exec_unreported_exception, NULL);
618
619PyMODINIT_FUNC
620PyInit__testmultiphase_exec_unreported_exception(PyObject *spec)
621{
622 return PyModuleDef_Init(&def_exec_unreported_exception);
623}
Nick Coghlan9d3c61c2015-09-05 21:05:05 +1000624
Marcel Plchc2b0b122018-03-17 06:41:20 +0100625static int
626bad_traverse(PyObject *self, visitproc visit, void *arg) {
627 testmultiphase_state *m_state;
628
629 m_state = PyModule_GetState(self);
Michael Felt1bf88452019-02-17 13:02:56 +0100630
631 /* The following assertion mimics any traversal function that doesn't correctly handle
632 * the case during module creation where the module state hasn't been created yet.
633 *
634 * The check that it is used to test only runs in debug mode, so it is OK that the
635 * assert() will get compiled out in fully optimised release builds.
636 */
637 assert(m_state != NULL);
Marcel Plchc2b0b122018-03-17 06:41:20 +0100638 Py_VISIT(m_state->integer);
639 return 0;
640}
641
642static int
643execfunc_with_bad_traverse(PyObject *mod) {
644 testmultiphase_state *m_state;
645
646 m_state = PyModule_GetState(mod);
647 if (m_state == NULL) {
648 return -1;
649 }
650
651 m_state->integer = PyLong_FromLong(0x7fffffff);
652 Py_INCREF(m_state->integer);
653
654 return 0;
655}
656
657static PyModuleDef_Slot slots_with_bad_traverse[] = {
658 {Py_mod_exec, execfunc_with_bad_traverse},
659 {0, NULL}
660};
661
662static PyModuleDef def_with_bad_traverse = TEST_MODULE_DEF_EX(
663 "_testmultiphase_with_bad_traverse", slots_with_bad_traverse, NULL,
664 sizeof(testmultiphase_state), bad_traverse);
665
666PyMODINIT_FUNC
667PyInit__testmultiphase_with_bad_traverse(PyObject *spec) {
668 return PyModuleDef_Init(&def_with_bad_traverse);
669}
670
Nick Coghlan9d3c61c2015-09-05 21:05:05 +1000671/*** Helper for imp test ***/
672
673static PyModuleDef imp_dummy_def = TEST_MODULE_DEF("imp_dummy", main_slots, testexport_methods);
674
675PyMODINIT_FUNC
676PyInit_imp_dummy(PyObject *spec)
677{
678 return PyModuleDef_Init(&imp_dummy_def);
679}
Marcel Plchc2b0b122018-03-17 06:41:20 +0100680