Skip to content

Commit

Permalink
profile._f_lineno: handle next_line being None in Python 3.13 (#8710)
Browse files Browse the repository at this point in the history
In Python 3.13, it's possible for `dis.findlinestarts` to return
a line number as `None`. We don't ever want to return `None` as
the line number, so guard against this.

Signed-off-by: Adam Williamson <[email protected]>
  • Loading branch information
AdamWill authored Jun 20, 2024
1 parent aeebb2d commit 8506165
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion distributed/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def _f_lineno(frame: FrameType) -> int:
for start, next_line in dis.findlinestarts(code):
if f_lasti < start:
return prev_line
prev_line = next_line
if next_line:
prev_line = next_line

return prev_line
except Exception:
Expand Down

0 comments on commit 8506165

Please sign in to comment.