summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/pychrysalide/helpers.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/pychrysalide/helpers.c b/plugins/pychrysalide/helpers.c
index 674221b..6ffb4fe 100644
--- a/plugins/pychrysalide/helpers.c
+++ b/plugins/pychrysalide/helpers.c
@@ -356,6 +356,9 @@ PyObject *build_python_module(PyObject *super, PyModuleDef *def)
{
PyObject *result; /* Création à retourner */
int ret; /* Bilan d'un appel */
+#if PY_VERSION_HEX >= 0x03070000
+ PyObject *modules; /* Modules de l'interpréteur */
+#endif
char *dot; /* Dernier point de ce chemin */
result = PyModule_Create(def);
@@ -364,7 +367,12 @@ PyObject *build_python_module(PyObject *super, PyModuleDef *def)
ret = PyState_AddModule(super, def);
if (ret != 0) goto bad_exit;
+#if PY_VERSION_HEX >= 0x03070000
+ modules = PyImport_GetModuleDict();
+ ret = _PyImport_FixupBuiltin(result, def->m_name, modules);
+#else
ret = _PyImport_FixupBuiltin(result, def->m_name);
+#endif
if (ret != 0) goto bad_exit;
dot = strrchr(def->m_name, '.');