Merge pull request #348 from lightovernight/fix-lineno

Fix line number reporting in trace functions for function calls
This commit is contained in:
BLUELOVETH 2025-03-07 18:17:14 +08:00 committed by GitHub
commit 1d73bdf241
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,8 +121,11 @@ 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) return 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;
return 0;
} }
int Frame__iblock(const py_Frame* self) { int Frame__iblock(const py_Frame* self) {