diff options
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-x | numpy/f2py/rules.py | 10 | ||||
-rw-r--r-- | numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c | 12 |
2 files changed, 3 insertions, 19 deletions
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 3e84de2a6..e556db34c 100755 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -192,13 +192,7 @@ static struct PyModuleDef moduledef = { }; #endif -#if PY_VERSION_HEX >= 0x03000000 -#define RETVAL m PyMODINIT_FUNC PyInit_#modulename#(void) { -#else -#define RETVAL -PyMODINIT_FUNC init#modulename#(void) { -#endif \tint i; \tPyObject *m,*d, *s, *tmp; #if PY_VERSION_HEX >= 0x03000000 @@ -209,7 +203,7 @@ PyMODINIT_FUNC init#modulename#(void) { \tPy_TYPE(&PyFortran_Type) = &PyType_Type; \timport_array(); \tif (PyErr_Occurred()) -\t\t{PyErr_SetString(PyExc_ImportError, \"can't initialize module #modulename# (failed to import numpy)\"); return RETVAL;} +\t\t{PyErr_SetString(PyExc_ImportError, \"can't initialize module #modulename# (failed to import numpy)\"); return m;} \td = PyModule_GetDict(m); \ts = PyString_FromString(\"$R""" + """evision: $\"); \tPyDict_SetItemString(d, \"__version__\", s); @@ -243,7 +237,7 @@ PyMODINIT_FUNC init#modulename#(void) { \tif (! PyErr_Occurred()) \t\ton_exit(f2py_report_on_exit,(void*)\"#modulename#\"); #endif -\treturn RETVAL; +\treturn m; } #ifdef __cplusplus } diff --git a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c index 978db4e69..369221c75 100644 --- a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c +++ b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c @@ -143,19 +143,9 @@ static struct PyModuleDef moduledef = { }; #endif -#if PY_VERSION_HEX >= 0x03000000 -#define RETVAL m PyMODINIT_FUNC 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); -#endif Py_TYPE(&PyFortran_Type) = &PyType_Type; import_array(); if (PyErr_Occurred()) @@ -238,7 +228,7 @@ PyMODINIT_FUNC inittest_array_from_pyobj_ext(void) { on_exit(f2py_report_on_exit,(void*)"array_from_pyobj.wrap.call"); #endif - return RETVAL; + return m; } #ifdef __cplusplus } |