[pypy-commit] pypy object-dtype2: prefer obscure exception to a segfault
mattip
noreply at buildbot.pypy.org
Sun Apr 19 22:31:46 CEST 2015
Author: mattip <matti.picus at gmail.com>
Branch: object-dtype2
Changeset: r76837:df509dc69d3e
Date: 2015-04-19 23:25 +0300
http://bitbucket.org/pypy/pypy/changeset/df509dc69d3e/
Log: prefer obscure exception to a segfault
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -1686,9 +1686,12 @@
self._write(storage, i, offset, value, gcstruct)
def unbox(self, box):
- assert isinstance(box, self.BoxType)
- return box.w_obj
-
+ if isinstance(box, self.BoxType):
+ return box.w_obj
+ else:
+ raise oefmt(self.space.w_NotImplementedError,
+ "object dtype cannot unbox %s", str(box))
+
@specialize.argtype(1)
def box(self, w_obj):
if isinstance(w_obj, W_Root):
More information about the pypy-commit
mailing list