summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-12-10 07:27:20 +0200
committermattip <matti.picus@gmail.com>2018-12-10 07:31:20 +0200
commit1c7a2f928dac1e66296fc2d097901b249b68d592 (patch)
tree0f9e20ff6618ac29faa28d7d367f7cd1e5a5daa1 /numpy
parente64354e01fe49cf0a4ccf1b45bce1e9dbddabe86 (diff)
downloadnumpy-1c7a2f928dac1e66296fc2d097901b249b68d592.tar.gz
BUG: call PyType_Ready before using type
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c3
-rw-r--r--numpy/core/src/umath/umathmodule.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
index ce8af4392..00f8f6e72 100644
--- a/numpy/core/src/multiarray/multiarraymodule.c
+++ b/numpy/core/src/multiarray/multiarraymodule.c
@@ -4570,6 +4570,9 @@ PyMODINIT_FUNC init_multiarray_umath(void) {
*/
PyArray_Type.tp_hash = PyObject_HashNotImplemented;
+ if (PyType_Ready(&PyUFunc_Type) < 0)
+ goto err;
+
/* Load the ufunc operators into the array module's namespace */
if (InitOperators(d) < 0) {
goto err;
diff --git a/numpy/core/src/umath/umathmodule.c b/numpy/core/src/umath/umathmodule.c
index 8277ad6cc..5de19fec2 100644
--- a/numpy/core/src/umath/umathmodule.c
+++ b/numpy/core/src/umath/umathmodule.c
@@ -268,10 +268,6 @@ int initumath(PyObject *m)
UFUNC_FLOATING_POINT_SUPPORT = 0;
#endif
- /* Initialize the types */
- if (PyType_Ready(&PyUFunc_Type) < 0)
- return -1;
-
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);