mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 12:30:19 +00:00
...
This commit is contained in:
parent
0666a6d370
commit
791d9f39d3
@ -11,7 +11,8 @@
|
|||||||
static bool stack_unpack_sequence(VM* self, uint16_t arg);
|
static bool stack_unpack_sequence(VM* self, uint16_t arg);
|
||||||
static bool stack_format_object(VM* self, c11_sv spec);
|
static bool stack_format_object(VM* self, c11_sv spec);
|
||||||
|
|
||||||
#define CHECK_RETURN_FROM_EXCEPT_OR_FINALLY() if(self->is_curr_exc_handled) py_clearexc(NULL)
|
#define CHECK_RETURN_FROM_EXCEPT_OR_FINALLY() \
|
||||||
|
if(self->is_curr_exc_handled) py_clearexc(NULL)
|
||||||
|
|
||||||
#define DISPATCH() \
|
#define DISPATCH() \
|
||||||
do { \
|
do { \
|
||||||
@ -992,7 +993,8 @@ FrameResult VM__run_top_frame(VM* self) {
|
|||||||
goto __ERROR;
|
goto __ERROR;
|
||||||
}
|
}
|
||||||
case OP_RE_RAISE: {
|
case OP_RE_RAISE: {
|
||||||
if(self->curr_exception.type && !self->is_curr_exc_handled) {
|
if(self->curr_exception.type) {
|
||||||
|
assert(!self->is_curr_exc_handled);
|
||||||
goto __ERROR_RE_RAISE;
|
goto __ERROR_RE_RAISE;
|
||||||
}
|
}
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
@ -1003,6 +1005,7 @@ FrameResult VM__run_top_frame(VM* self) {
|
|||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
case OP_BEGIN_EXC_HANDLING: {
|
case OP_BEGIN_EXC_HANDLING: {
|
||||||
|
assert(self->curr_exception.type);
|
||||||
self->is_curr_exc_handled = true;
|
self->is_curr_exc_handled = true;
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
@ -1012,13 +1015,15 @@ FrameResult VM__run_top_frame(VM* self) {
|
|||||||
}
|
}
|
||||||
case OP_BEGIN_FINALLY: {
|
case OP_BEGIN_FINALLY: {
|
||||||
if(self->curr_exception.type) {
|
if(self->curr_exception.type) {
|
||||||
|
assert(!self->is_curr_exc_handled);
|
||||||
// temporarily handle the exception if any
|
// temporarily handle the exception if any
|
||||||
self->is_curr_exc_handled = true;
|
self->is_curr_exc_handled = true;
|
||||||
}
|
}
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
case OP_END_FINALLY: {
|
case OP_END_FINALLY: {
|
||||||
if(self->curr_exception.type && self->is_curr_exc_handled) {
|
if(self->curr_exception.type) {
|
||||||
|
assert(self->is_curr_exc_handled);
|
||||||
// revert the exception handling if needed
|
// revert the exception handling if needed
|
||||||
self->is_curr_exc_handled = false;
|
self->is_curr_exc_handled = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user