summaryrefslogtreecommitdiff
path: root/numpy/core/_exceptions.py
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@google.com>2019-05-13 08:09:26 -0700
committerStephan Hoyer <shoyer@google.com>2019-05-13 08:09:26 -0700
commit07452c86c78a1cf213a764d17f060b4887ec3681 (patch)
tree12c7ae7b14552bd28334277e7e244b603ca4300a /numpy/core/_exceptions.py
parent804f71bb42fef775a85a52366dc4bd1a22c130a8 (diff)
parent4ad33d21b1a30f931e23307e9f9355b70f633bed (diff)
downloadnumpy-07452c86c78a1cf213a764d17f060b4887ec3681.tar.gz
Merge branch 'master' into implement-numpy-implementation
Diffstat (limited to 'numpy/core/_exceptions.py')
-rw-r--r--numpy/core/_exceptions.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/core/_exceptions.py b/numpy/core/_exceptions.py
index a1997ef6b..1dcea6255 100644
--- a/numpy/core/_exceptions.py
+++ b/numpy/core/_exceptions.py
@@ -121,3 +121,15 @@ class AxisError(ValueError, IndexError):
msg = "{}: {}".format(msg_prefix, msg)
super(AxisError, self).__init__(msg)
+
+
+@_display_as_base
+class _ArrayMemoryError(MemoryError):
+ """ Thrown when an array cannot be allocated"""
+ def __init__(self, shape, dtype):
+ self.shape = shape
+ self.dtype = dtype
+
+ def __str__(self):
+ return "Unable to allocate array with shape {} and data type {}".format(self.shape, self.dtype)
+