Merge pull request #135 from pfalcon/simple-raise
Crude attempt to implement RAISE_VARARGS (with args=1 so far only).
This commit is contained in:
commit
e9b4b7ac75
7
py/vm.c
7
py/vm.c
|
@ -474,6 +474,13 @@ bool mp_execute_byte_code_2(const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **
|
||||||
assert(exc_sp == &exc_stack[0] - 1);
|
assert(exc_sp == &exc_stack[0] - 1);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
case MP_BC_RAISE_VARARGS:
|
||||||
|
unum = *ip++;
|
||||||
|
assert(unum == 1);
|
||||||
|
obj1 = POP();
|
||||||
|
nlr_jump(obj1);
|
||||||
|
return false;
|
||||||
|
|
||||||
case MP_BC_YIELD_VALUE:
|
case MP_BC_YIELD_VALUE:
|
||||||
nlr_pop();
|
nlr_pop();
|
||||||
*ip_in_out = ip;
|
*ip_in_out = ip;
|
||||||
|
|
|
@ -4,3 +4,8 @@ try:
|
||||||
x.a()
|
x.a()
|
||||||
except:
|
except:
|
||||||
print(x)
|
print(x)
|
||||||
|
|
||||||
|
try:
|
||||||
|
raise IndexError
|
||||||
|
except IndexError:
|
||||||
|
print("caught")
|
||||||
|
|
Loading…
Reference in New Issue