summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Lamy <ronan.lamy@gmail.com>2020-12-24 18:23:46 +0100
committerRonan Lamy <ronan.lamy@gmail.com>2020-12-24 18:23:46 +0100
commit6c65d01705dffb2b285531813dc40cbc71799d8d (patch)
treee1d1ecbf220daf6b38876a08931806f7b5f83039
parent2e5502ecaab235d9a1b5e4ae341a86714f981355 (diff)
downloadnumpy-6c65d01705dffb2b285531813dc40cbc71799d8d.tar.gz
MAINT: Remove obsolete workaround to set ndarray.__hash__ = None
In Python 3, a type that sets tp_richcompare but leaves tp_hash null is always unhashable. In Python 2, such types used to inherit tp_hash from their bases.
-rw-r--r--numpy/core/src/multiarray/arrayobject.c4
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c7
2 files changed, 0 insertions, 11 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c
index a2474d79f..1326140d5 100644
--- a/numpy/core/src/multiarray/arrayobject.c
+++ b/numpy/core/src/multiarray/arrayobject.c
@@ -1754,10 +1754,6 @@ NPY_NO_EXPORT PyTypeObject PyArray_Type = {
.tp_as_number = &array_as_number,
.tp_as_sequence = &array_as_sequence,
.tp_as_mapping = &array_as_mapping,
- /*
- * The tp_hash slot will be set PyObject_HashNotImplemented when the
- * module is loaded.
- */
.tp_str = (reprfunc)array_str,
.tp_as_buffer = &array_as_buffer,
.tp_flags =(Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE),
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
index e10fe39bd..dfd27a0bc 100644
--- a/numpy/core/src/multiarray/multiarraymodule.c
+++ b/numpy/core/src/multiarray/multiarraymodule.c
@@ -4556,13 +4556,6 @@ PyMODINIT_FUNC PyInit__multiarray_umath(void) {
goto err;
}
- /*
- * Before calling PyType_Ready, initialize the tp_hash slot in
- * PyArray_Type to work around mingw32 not being able initialize
- * static structure slots with functions from the Python C_API.
- */
- PyArray_Type.tp_hash = PyObject_HashNotImplemented;
-
if (PyType_Ready(&PyUFunc_Type) < 0) {
goto err;
}