summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-29 02:52:17 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-29 04:35:36 +0200
commit682f9e639d140849a5b33aecb74e2e2cb2c6ee77 (patch)
treeb3900bf759dfb4dca95f72d740d1a7845edafa15
parent4fff26a35cf88765efc1ca0595fa2b26eff4fc84 (diff)
vm: Make sure that exception triple is <type, instance, traceback>.
This reduntant triple is one of the ugliest parts of Python, which they chickened out to fix in Python3. We really should consider passing just as single exception instance (without breaking Python-level APIs of course), but until we do, let's follow CPython layout.
-rw-r--r--py/vm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/vm.c b/py/vm.c
index 710fd1253..60ed641a8 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -415,8 +415,8 @@ unwind_jump:
// if TOS is None, just pops it and continues
// if TOS is an integer, does something else
// else error
- if (mp_obj_is_exception_instance(TOP())) {
- nlr_jump(TOP());
+ if (mp_obj_is_exception_type(TOP())) {
+ nlr_jump(sp[-1]);
}
if (TOP() == mp_const_none) {
sp--;
@@ -716,7 +716,7 @@ unwind_return:
// push(traceback, exc-val, exc-type)
PUSH(mp_const_none);
PUSH(nlr.ret_val);
- PUSH(nlr.ret_val); // TODO should be type(nlr.ret_val), I think...
+ PUSH(mp_obj_get_type(nlr.ret_val));
} else {
// propagate exception to higher level