diff options
author | Pauli Virtanen <pav@iki.fi> | 2010-03-06 23:59:41 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2010-03-06 23:59:41 +0000 |
commit | 11ff8356427c9f04968869c1caf75f09eff8bb79 (patch) | |
tree | 1ef857a84abb83dbbcbd771dcaa21e2e18175cc0 /numpy/f2py/tests | |
parent | 80f6b2a2ceb7981c292fd3071f5d2eba1c9866ab (diff) | |
download | numpy-11ff8356427c9f04968869c1caf75f09eff8bb79.tar.gz |
3K: f2py: port the array_from_pyobj test module to Py3
Diffstat (limited to 'numpy/f2py/tests')
-rw-r--r-- | numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c | 27 | ||||
-rw-r--r-- | numpy/f2py/tests/test_callback.py | 2 |
2 files changed, 27 insertions, 2 deletions
diff --git a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c index df316c2b5..71bee783d 100644 --- a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c +++ b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c @@ -114,10 +114,34 @@ static PyMethodDef f2py_module_methods[] = { {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 @@ PyMODINIT_FUNC inittest_array_from_pyobj_ext(void) { on_exit(f2py_report_on_exit,(void*)"array_from_pyobj.wrap.call"); #endif + return RETVAL; } #ifdef __cplusplus } diff --git a/numpy/f2py/tests/test_callback.py b/numpy/f2py/tests/test_callback.py index f2c99d7a4..aec11052e 100644 --- a/numpy/f2py/tests/test_callback.py +++ b/numpy/f2py/tests/test_callback.py @@ -35,7 +35,7 @@ cf2py intent(out) a 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) |