summaryrefslogtreecommitdiff
path: root/numpy/f2py
diff options
context:
space:
mode:
authorSeth Troisi <sethtroisi@google.com>2020-01-03 13:23:52 -0800
committerSebastian Berg <sebastian@sipsolutions.net>2020-01-03 15:23:52 -0600
commite1aecb08f99321b72959cc50eb7b47454b613f52 (patch)
tree369d1ad3168c7a160072d39768217d680dac3e0a /numpy/f2py
parentf30b2564d3923b2c307a026e4a22d20bc19872f0 (diff)
downloadnumpy-e1aecb08f99321b72959cc50eb7b47454b613f52.tar.gz
MAINT: Remove Python2 specific C module setup (gh-15231)
Dropping the support for python 2, the difference in module setup do not have to be accounted for anymore. This removes the macros and ifdef's related to module setup code and python 2 support.
Diffstat (limited to 'numpy/f2py')
-rwxr-xr-xnumpy/f2py/rules.py10
-rw-r--r--numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c12
2 files changed, 3 insertions, 19 deletions
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py
index 28eb9da30..a147f94b4 100755
--- a/numpy/f2py/rules.py
+++ b/numpy/f2py/rules.py
@@ -194,13 +194,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
@@ -211,7 +205,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);
@@ -245,7 +239,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
}