summaryrefslogtreecommitdiff
path: root/c/cffi1_module.c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-01-08 11:01:49 +0100
committerArmin Rigo <arigo@tunes.org>2016-01-08 11:01:49 +0100
commit67a018017d788b03619b38631439e31514837d6c (patch)
treec153351c93aba445a61529b6bb72d0d36c7b5c75 /c/cffi1_module.c
parent6cde8fe03724d78dbb61b510af06a2211eae98aa (diff)
downloadcffi-67a018017d788b03619b38631439e31514837d6c.tar.gz
in-progress: work work work to port this to Python 3
Diffstat (limited to 'c/cffi1_module.c')
-rw-r--r--c/cffi1_module.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/c/cffi1_module.c b/c/cffi1_module.c
index b0f52a3..2fe95e0 100644
--- a/c/cffi1_module.c
+++ b/c/cffi1_module.c
@@ -212,5 +212,12 @@ static PyObject *b_init_cffi_1_0_external_module(PyObject *self, PyObject *arg)
(PyObject *)lib) < 0)
return NULL;
+#if PY_MAJOR_VERSION >= 3
+ /* add manually 'module_name' in sys.modules: it seems that
+ Py_InitModule() is not enough to do that */
+ if (PyDict_SetItemString(modules_dict, module_name, m) < 0)
+ return NULL;
+#endif
+
return m;
}