We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4861863 commit 095a0ccCopy full SHA for 095a0cc
crates/vm/src/builtins/frame.rs
@@ -64,7 +64,13 @@ impl Frame {
64
65
#[pygetset]
66
pub fn f_lineno(&self) -> usize {
67
- self.current_location().line.get()
+ // If lasti is 0, execution hasn't started yet - use first line number
68
+ // Similar to PyCode_Addr2Line which returns co_firstlineno for addr_q < 0
69
+ if self.lasti() == 0 {
70
+ self.code.first_line_number.map(|n| n.get()).unwrap_or(1)
71
+ } else {
72
+ self.current_location().line.get()
73
+ }
74
}
75
76
0 commit comments