[Scipy-svn] r6704 - trunk/scipy/cluster/src

scipy-svn at scipy.org scipy-svn at scipy.org
Sat Sep 11 20:46:10 EDT 2010


Author: ptvirtan
Date: 2010-09-11 19:46:10 -0500 (Sat, 11 Sep 2010)
New Revision: 6704

Modified:
   trunk/scipy/cluster/src/hierarchy_wrap.c
   trunk/scipy/cluster/src/vq_module.c
Log:
3K: add py3k compatible module init for cluster.

Modified: trunk/scipy/cluster/src/hierarchy_wrap.c
===================================================================
--- trunk/scipy/cluster/src/hierarchy_wrap.c	2010-09-12 00:45:19 UTC (rev 6703)
+++ trunk/scipy/cluster/src/hierarchy_wrap.c	2010-09-12 00:46:10 UTC (rev 6704)
@@ -373,7 +373,31 @@
   {NULL, NULL}     /* Sentinel - marks the end of this structure */
 };
 
+#if defined(SCIPY_PY3K)
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "_vq",
+    NULL,
+    -1,
+    _hierarchyWrapMethods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+PyObject *PyInit__hierarchy_wrap(void)
+{
+    PyObject *m;
+
+    m = PyModule_Create(&moduledef);
+    import_array();
+
+    return m;
+}
+#else
 PyMODINIT_FUNC init_hierarchy_wrap(void)  {
   (void) Py_InitModule("_hierarchy_wrap", _hierarchyWrapMethods);
   import_array();  // Must be present for NumPy.  Called first after above line.
 }
+#endif

Modified: trunk/scipy/cluster/src/vq_module.c
===================================================================
--- trunk/scipy/cluster/src/vq_module.c	2010-09-12 00:45:19 UTC (rev 6703)
+++ trunk/scipy/cluster/src/vq_module.c	2010-09-12 00:46:10 UTC (rev 6704)
@@ -15,11 +15,35 @@
     {NULL, NULL, 0, NULL}
 };
 
+#if defined(SCIPY_PY3K)
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "_vq",
+    NULL,
+    -1,
+    vqmethods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+
+PyObject *PyInit__vq(void)
+{
+    PyObject *m;
+
+    m = PyModule_Create(&moduledef);
+    import_array();
+
+    return m;
+}
+#else
 PyMODINIT_FUNC init_vq(void) 
 {
     Py_InitModule("_vq", vqmethods);
     import_array();
 }
+#endif
 
 PyObject* compute_vq(PyObject* self, PyObject* args)
 {




More information about the Scipy-svn mailing list