From 37c72bc890f047842f996dcc9ee679a8f220cde0 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 22 Mar 2019 22:30:01 +0100 Subject: Updated code to support one Python 3.7 API change. --- plugins/pychrysalide/helpers.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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, '.'); -- cgit v0.11.2-87-g4458