Message168261
I tried it and it works to just insert the package module into sys.modules after creation if it's not there yet:
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("my_test_package"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (!__pyx_m) {...};
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {...}
if (!PyDict_GetItemString(modules, "my_test_package"))
if (unlikely(PyDict_SetItemString(modules, "my_test_package", __pyx_m) < 0)) {...}
So this is a work-around that we can use in Cython in any case. |
|
Date |
User |
Action |
Args |
2012-08-15 06:15:44 | scoder | set | recipients:
+ scoder, brett.cannon, georg.brandl, Arfrever, meador.inge, eric.snow |
2012-08-15 06:15:44 | scoder | set | messageid: <1345011344.2.0.287140564082.issue15623@psf.upfronthosting.co.za> |
2012-08-15 06:15:43 | scoder | link | issue15623 messages |
2012-08-15 06:15:43 | scoder | create | |
|