mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
791d9f39d3
commit
00bdfe66cf
@ -1108,7 +1108,7 @@ static void Ctx__dtor(Ctx* self) {
|
|||||||
static bool is_small_int(int64_t value) { return value >= INT16_MIN && value <= INT16_MAX; }
|
static bool is_small_int(int64_t value) { return value >= INT16_MIN && value <= INT16_MAX; }
|
||||||
|
|
||||||
static bool is_context_block(CodeBlock* block) {
|
static bool is_context_block(CodeBlock* block) {
|
||||||
return block->type >= CodeBlockType_WITH && block->type <= CodeBlockType_FINALLY;
|
return block->type >= CodeBlockType_FOR_LOOP && block->type <= CodeBlockType_FINALLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Ctx__get_loop(Ctx* self, bool* has_context) {
|
static int Ctx__get_loop(Ctx* self, bool* has_context) {
|
||||||
|
@ -1010,6 +1010,7 @@ FrameResult VM__run_top_frame(VM* self) {
|
|||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
case OP_END_EXC_HANDLING: {
|
case OP_END_EXC_HANDLING: {
|
||||||
|
assert(self->curr_exception.type);
|
||||||
py_clearexc(NULL);
|
py_clearexc(NULL);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "pocketpy/interpreter/frame.h"
|
#include "pocketpy/interpreter/frame.h"
|
||||||
#include "pocketpy/interpreter/vm.h"
|
#include "pocketpy/interpreter/vm.h"
|
||||||
|
#include "pocketpy/objects/base.h"
|
||||||
#include "pocketpy/objects/codeobject.h"
|
#include "pocketpy/objects/codeobject.h"
|
||||||
#include "pocketpy/objects/object.h"
|
|
||||||
#include "pocketpy/pocketpy.h"
|
#include "pocketpy/pocketpy.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
@ -99,10 +99,10 @@ void Frame__prepare_jump_break(Frame* self, ValueStack* _s, int target) {
|
|||||||
|
|
||||||
int Frame__exit_block(Frame* self, ValueStack* _s, int iblock) {
|
int Frame__exit_block(Frame* self, ValueStack* _s, int iblock) {
|
||||||
CodeBlock* block = c11__at(CodeBlock, &self->co->blocks, iblock);
|
CodeBlock* block = c11__at(CodeBlock, &self->co->blocks, iblock);
|
||||||
if(block->type == CodeBlockType_FOR_LOOP) {
|
if(block->type == CodeBlockType_FOR_LOOP || block->type == CodeBlockType_WITH) {
|
||||||
_s->sp--; // pop iterator
|
_s->sp--; // pop iterator or context variable
|
||||||
} else if(block->type == CodeBlockType_WITH) {
|
} else if(block->type == CodeBlockType_EXCEPT || block->type == CodeBlockType_FINALLY) {
|
||||||
_s->sp--; // pop context variable
|
py_clearexc(NULL);
|
||||||
}
|
}
|
||||||
return block->parent;
|
return block->parent;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user