summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/helpers.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-03-22 21:30:01 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-03-22 21:30:01 (GMT)
commit37c72bc890f047842f996dcc9ee679a8f220cde0 (patch)
tree533e282c9bdceed225c4e99bb203027f3f930ac4 /plugins/pychrysalide/helpers.c
parent49052753583c9468853238d026ff36dd70e47723 (diff)
Updated code to support one Python 3.7 API change.
Diffstat (limited to 'plugins/pychrysalide/helpers.c')
-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, '.');