Stefan Behnel added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15623>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to