Catch an (crashing #45 ) edge case where the frame's current line numer is wrong, or the discoverd line number where the frame's code block starts is. This looks like a python bug or an inspect.getsource bug -- OR a getsource bug that is ultimately a python bug, because inspect just uses frame.f_code.co_firstlineno (= the frame's own reported beginning of its code block), and I can't imagine a situation where that can legitimately not contain frame.f_lineno.
I deal with this here by showing a warning in-band that the line number can't be 100% trusted, while also moving the active line shown down to the first available source line.
(Not completely happy with that solution, of course)
Catch an (crashing #45 ) edge case where the frame's current line numer is wrong, or the discoverd line number where the frame's code block starts is. This looks like a python bug or an
inspect.getsource
bug -- OR a getsource bug that is ultimately a python bug, becauseinspect
just usesframe.f_code.co_firstlineno
(= the frame's own reported beginning of its code block), and I can't imagine a situation where that can legitimately not containframe.f_lineno
.I deal with this here by showing a warning in-band that the line number can't be 100% trusted, while also moving the active line shown down to the first available source line.
(Not completely happy with that solution, of course)