This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients Arfrever, brett.cannon, eric.snow, georg.brandl, meador.inge, scoder
Date 2012-08-15.06:15:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345011344.2.0.287140564082.issue15623@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-08-15 06:15:44scodersetrecipients: + scoder, brett.cannon, georg.brandl, Arfrever, meador.inge, eric.snow
2012-08-15 06:15:44scodersetmessageid: <1345011344.2.0.287140564082.issue15623@psf.upfronthosting.co.za>
2012-08-15 06:15:43scoderlinkissue15623 messages
2012-08-15 06:15:43scodercreate