[Numpy-svn] r8287 - in trunk/numpy/f2py/tests: . src/array_from_pyobj

numpy-svn@scip... numpy-svn@scip...
Sat Mar 6 17:59:41 CST 2010


Author: ptvirtan
Date: 2010-03-06 17:59:41 -0600 (Sat, 06 Mar 2010)
New Revision: 8287

Modified:
   trunk/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
   trunk/numpy/f2py/tests/test_callback.py
Log:
3K: f2py: port the array_from_pyobj test module to Py3

Modified: trunk/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
===================================================================
--- trunk/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c	2010-03-06 23:59:22 UTC (rev 8286)
+++ trunk/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c	2010-03-06 23:59:41 UTC (rev 8287)
@@ -114,10 +114,34 @@
   {NULL,NULL}
 };
 
+#if PY_VERSION_HEX >= 0x03000000
+static struct PyModuleDef moduledef = {
+    PyModuleDef_HEAD_INIT,
+    "test_array_from_pyobj_ext",
+    NULL,
+    -1,
+    f2py_module_methods,
+    NULL,
+    NULL,
+    NULL,
+    NULL
+};
+#endif
+
+#if PY_VERSION_HEX >= 0x03000000
+#define RETVAL m
+PyObject *PyInit_test_array_from_pyobj_ext(void) {
+#else
+#define RETVAL
 PyMODINIT_FUNC inittest_array_from_pyobj_ext(void) {
+#endif
   PyObject *m,*d, *s;
+#if PY_VERSION_HEX >= 0x03000000
+  m = wrap_module = PyModule_Create(&moduledef);
+#else
   m = wrap_module = Py_InitModule("test_array_from_pyobj_ext", f2py_module_methods);
-  PyFortran_Type.ob_type = &PyType_Type;
+#endif
+  Py_TYPE(&PyFortran_Type) = &PyType_Type;
   import_array();
   if (PyErr_Occurred())
     Py_FatalError("can't initialize module wrap (failed to import numpy)");
@@ -190,6 +214,7 @@
   on_exit(f2py_report_on_exit,(void*)"array_from_pyobj.wrap.call");
 #endif
 
+  return RETVAL;
 }
 #ifdef __cplusplus
 }

Modified: trunk/numpy/f2py/tests/test_callback.py
===================================================================
--- trunk/numpy/f2py/tests/test_callback.py	2010-03-06 23:59:22 UTC (rev 8286)
+++ trunk/numpy/f2py/tests/test_callback.py	2010-03-06 23:59:41 UTC (rev 8287)
@@ -35,7 +35,7 @@
 
     def test_all(self):
         for name in "t,t2".split(","):
-            yield self.check_function, name
+            self.check_function(name)
 
     def check_function(self, name):
         t = getattr(self.module, name)



More information about the Numpy-svn mailing list