summaryrefslogtreecommitdiff
path: root/numpy/lib/src
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2009-12-06 12:05:26 +0000
committerPauli Virtanen <pav@iki.fi>2009-12-06 12:05:26 +0000
commitb8f19165477c549646b4ab540dd2cd2adcb3dad2 (patch)
treef3517e219dd93f0012f65cb67a7532cc3bfc32cd /numpy/lib/src
parent1fc4a731d50397406b5d5801476db6a56e5d8eb8 (diff)
downloadnumpy-b8f19165477c549646b4ab540dd2cd2adcb3dad2.tar.gz
3K: lib: module init for _compiled_base
Diffstat (limited to 'numpy/lib/src')
-rw-r--r--numpy/lib/src/_compiled_base.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index 4a54ea1a9..e272e835a 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -928,12 +928,39 @@ define_types(void)
return;
}
-/* Initialization function for the module (*must* be called init<name>) */
-PyMODINIT_FUNC init_compiled_base(void) {
+#if defined(NPY_PY3K)
+static struct PyModuleDef moduledef = {
+ PyModuleDef_HEAD_INIT,
+ "_compiled_base",
+ NULL,
+ -1,
+ methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+#endif
+
+#if defined(NPY_PY3K)
+#define RETVAL m
+PyObject *PyInit__compiled_base(void)
+#else
+#define RETVAL
+PyMODINIT_FUNC
+init_compiled_base(void)
+#endif
+{
PyObject *m, *d, *s;
- /* Create the module and add the functions */
+#if defined(NPY_PY3K)
+ m = PyModule_Create(&moduledef);
+#else
m = Py_InitModule("_compiled_base", methods);
+#endif
+ if (!m) {
+ return RETVAL;
+ }
/* Import the array objects */
import_array();
@@ -952,5 +979,5 @@ PyMODINIT_FUNC init_compiled_base(void) {
/* define PyGetSetDescr_Type and PyMemberDescr_Type */
define_types();
- return;
+ return RETVAL;
}