Commit 65cbfd1d authored by Stefan Behnel's avatar Stefan Behnel

fix module_api test

parent 8fd80d05
...@@ -108,6 +108,18 @@ void inita(void) ...@@ -108,6 +108,18 @@ void inita(void)
if (!sys_modules) return; if (!sys_modules) return;
mod = PyInit_a(); mod = PyInit_a();
if (!mod) return; if (!mod) return;
#if PY_VERSION_HEX >= 0x03050000
/* FIXME: this is incomplete and users shouldn't have to do this in the first place... */
if (!PyModule_Check(mod)) {
PyModuleDef *mdef = (PyModuleDef*)mod;
PyObject *modname = PyUnicode_FromString("a");
if (!modname) return;
mod = PyModule_NewObject(modname);
Py_DECREF(modname);
if (!mod) return;
PyModule_ExecDef(mod, mdef);
}
#endif
PyDict_SetItemString(sys_modules, (char*)"a", mod); PyDict_SetItemString(sys_modules, (char*)"a", mod);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment