diff options
| author | Seth Troisi <sethtroisi@google.com> | 2020-01-03 13:23:52 -0800 |
|---|---|---|
| committer | Sebastian Berg <sebastian@sipsolutions.net> | 2020-01-03 15:23:52 -0600 |
| commit | e1aecb08f99321b72959cc50eb7b47454b613f52 (patch) | |
| tree | 369d1ad3168c7a160072d39768217d680dac3e0a /numpy/linalg | |
| parent | f30b2564d3923b2c307a026e4a22d20bc19872f0 (diff) | |
| download | numpy-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/linalg')
| -rw-r--r-- | numpy/linalg/lapack_litemodule.c | 18 | ||||
| -rw-r--r-- | numpy/linalg/umath_linalg.c.src | 19 |
2 files changed, 5 insertions, 32 deletions
diff --git a/numpy/linalg/lapack_litemodule.c b/numpy/linalg/lapack_litemodule.c index 56f38364f..362a593a6 100644 --- a/numpy/linalg/lapack_litemodule.c +++ b/numpy/linalg/lapack_litemodule.c @@ -377,7 +377,6 @@ static struct PyMethodDef lapack_lite_module_methods[] = { }; -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "lapack_lite", @@ -389,27 +388,14 @@ static struct PyModuleDef moduledef = { NULL, NULL }; -#endif /* Initialization function for the module */ -#if PY_MAJOR_VERSION >= 3 -#define RETVAL(x) x PyMODINIT_FUNC PyInit_lapack_lite(void) -#else -#define RETVAL(x) -PyMODINIT_FUNC -initlapack_lite(void) -#endif { PyObject *m,*d; -#if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); -#else - m = Py_InitModule4("lapack_lite", lapack_lite_module_methods, - "", (PyObject*)NULL,PYTHON_API_VERSION); -#endif if (m == NULL) { - return RETVAL(NULL); + return NULL; } import_array(); d = PyModule_GetDict(m); @@ -422,5 +408,5 @@ initlapack_lite(void) PyDict_SetItemString(d, "_ilp64", Py_False); #endif - return RETVAL(m); + return m; } diff --git a/numpy/linalg/umath_linalg.c.src b/numpy/linalg/umath_linalg.c.src index e864c541b..00ff6b7a8 100644 --- a/numpy/linalg/umath_linalg.c.src +++ b/numpy/linalg/umath_linalg.c.src @@ -3626,7 +3626,6 @@ static PyMethodDef UMath_LinAlgMethods[] = { {NULL, NULL, 0, NULL} /* Sentinel */ }; -#if defined(NPY_PY3K) static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, UMATH_LINALG_MODULE_NAME, @@ -3638,29 +3637,17 @@ static struct PyModuleDef moduledef = { NULL, NULL }; -#endif -#if defined(NPY_PY3K) -#define RETVAL(x) x PyObject *PyInit__umath_linalg(void) -#else -#define RETVAL(x) -PyMODINIT_FUNC -init_umath_linalg(void) -#endif { PyObject *m; PyObject *d; PyObject *version; init_constants(); -#if defined(NPY_PY3K) m = PyModule_Create(&moduledef); -#else - m = Py_InitModule(UMATH_LINALG_MODULE_NAME, UMath_LinAlgMethods); -#endif if (m == NULL) { - return RETVAL(NULL); + return NULL; } import_array(); @@ -3678,8 +3665,8 @@ init_umath_linalg(void) if (PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "cannot load _umath_linalg module."); - return RETVAL(NULL); + return NULL; } - return RETVAL(m); + return m; } |
