diff options
author | Ronan Lamy <ronan.lamy@gmail.com> | 2020-12-24 18:23:46 +0100 |
---|---|---|
committer | Ronan Lamy <ronan.lamy@gmail.com> | 2020-12-24 18:23:46 +0100 |
commit | 6c65d01705dffb2b285531813dc40cbc71799d8d (patch) | |
tree | e1d1ecbf220daf6b38876a08931806f7b5f83039 | |
parent | 2e5502ecaab235d9a1b5e4ae341a86714f981355 (diff) | |
download | numpy-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.c | 4 | ||||
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 7 |
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; } |