summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-07-01 01:04:51 -0600
committerGitHub <noreply@github.com>2021-07-01 01:04:51 -0600
commit755d7c3ec0371c25ff25c3142034f3555ab4fd27 (patch)
treeb4a5586b0e8f6e6c4ca886d3ab5a25ddec51885b
parent35a793c31faa1d7aeb1fd44cf79407132efcab08 (diff)
parent18afe1bcd89ef4262afc84c5dd5b2eade768a177 (diff)
downloadnumpy-755d7c3ec0371c25ff25c3142034f3555ab4fd27.tar.gz
Merge pull request #19381 from seberg/maint-init-order
MAINT: Modify initialization order during multiarray import
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
index b8ab52340..5fde890de 100644
--- a/numpy/core/src/multiarray/multiarraymodule.c
+++ b/numpy/core/src/multiarray/multiarraymodule.c
@@ -4702,15 +4702,6 @@ PyMODINIT_FUNC PyInit__multiarray_umath(void) {
goto err;
}
- /* Load the ufunc operators into the array module's namespace */
- if (InitOperators(d) < 0) {
- goto err;
- }
-
- if (set_matmul_flags(d) < 0) {
- goto err;
- }
-
PyArrayDTypeMeta_Type.tp_base = &PyType_Type;
if (PyType_Ready(&PyArrayDTypeMeta_Type) < 0) {
goto err;
@@ -4724,6 +4715,7 @@ PyMODINIT_FUNC PyInit__multiarray_umath(void) {
initialize_casting_tables();
initialize_numeric_types();
+
if (initscalarmath(m) < 0) {
goto err;
}
@@ -4734,6 +4726,7 @@ PyMODINIT_FUNC PyInit__multiarray_umath(void) {
if (setup_scalartypes(d) < 0) {
goto err;
}
+
PyArrayIter_Type.tp_iter = PyObject_SelfIter;
NpyIter_Type.tp_iter = PyObject_SelfIter;
PyArrayMultiIter_Type.tp_iter = PyObject_SelfIter;
@@ -4898,6 +4891,15 @@ PyMODINIT_FUNC PyInit__multiarray_umath(void) {
goto err;
}
+ /* Load the ufunc operators into the array module's namespace */
+ if (InitOperators(d) < 0) {
+ goto err;
+ }
+
+ if (set_matmul_flags(d) < 0) {
+ goto err;
+ }
+
if (initumath(m) != 0) {
goto err;
}