summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/arrayobject.c2
-rw-r--r--numpy/core/tests/test_multiarray.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c
index 6f9c89082..3f91b748c 100644
--- a/numpy/core/src/multiarray/arrayobject.c
+++ b/numpy/core/src/multiarray/arrayobject.c
@@ -1769,7 +1769,7 @@ NPY_NO_EXPORT PyTypeObject PyArray_Type = {
&array_as_number, /* tp_as_number */
&array_as_sequence, /* tp_as_sequence */
&array_as_mapping, /* tp_as_mapping */
- (hashfunc)0, /* tp_hash */
+ PyObject_HashNotImplemented, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)array_str, /* tp_str */
(getattrofunc)0, /* tp_getattro */
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 1e47a2297..fd3a0e13d 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -1,5 +1,6 @@
from __future__ import division, absolute_import, print_function
+import collections
import tempfile
import sys
import os
@@ -4848,5 +4849,12 @@ class TestSizeOf(TestCase):
assert_raises(TypeError, d.__sizeof__, "a")
+class TestHashing(TestCase):
+
+ def test_collections_hashable(self):
+ x = np.array([])
+ self.assertFalse(isinstance(x, collections.Hashable))
+
+
if __name__ == "__main__":
run_module_suite()