mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
fix a bug
This commit is contained in:
parent
92d3a589e8
commit
eba88e5541
@ -104,6 +104,7 @@ UnwindTarget* Frame__find_unwind_target(py_Frame* self, int iblock) {
|
|||||||
|
|
||||||
void Frame__set_unwind_target(py_Frame* self, py_TValue* sp) {
|
void Frame__set_unwind_target(py_Frame* self, py_TValue* sp) {
|
||||||
int iblock = Frame__iblock(self);
|
int iblock = Frame__iblock(self);
|
||||||
|
assert(iblock >= 0);
|
||||||
UnwindTarget* existing = Frame__find_unwind_target(self, iblock);
|
UnwindTarget* existing = Frame__find_unwind_target(self, iblock);
|
||||||
if(existing) {
|
if(existing) {
|
||||||
existing->offset = sp - self->p0;
|
existing->offset = sp - self->p0;
|
||||||
@ -121,15 +122,14 @@ void Frame__gc_mark(py_Frame* self) {
|
|||||||
|
|
||||||
int Frame__lineno(const py_Frame* self) {
|
int Frame__lineno(const py_Frame* self) {
|
||||||
int ip = self->ip;
|
int ip = self->ip;
|
||||||
if(ip >= 0)
|
if(ip >= 0) return c11__getitem(BytecodeEx, &self->co->codes_ex, ip).lineno;
|
||||||
return c11__getitem(BytecodeEx, &self->co->codes_ex, ip).lineno;
|
if(!self->is_locals_special) return self->co->start_line;
|
||||||
if(!self->is_locals_special)
|
|
||||||
return self->co->start_line;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Frame__iblock(const py_Frame* self) {
|
int Frame__iblock(const py_Frame* self) {
|
||||||
int ip = self->ip;
|
int ip = self->ip;
|
||||||
|
if(ip < 0) return -1;
|
||||||
return c11__getitem(BytecodeEx, &self->co->codes_ex, ip).iblock;
|
return c11__getitem(BytecodeEx, &self->co->codes_ex, ip).iblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user