Skip to content

Commit 825e943

Browse files
committed
fix: guard debug stack walk
1 parent 3060ceb commit 825e943

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

uvloop/cbhandles.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,16 @@ cdef extract_stack():
424424
return
425425

426426
try:
427-
stack = tb_StackSummary.extract(tb_walk_stack(f),
427+
frames = []
428+
while f is not None:
429+
lineno = getattr(f, "f_lineno", None)
430+
if lineno is None:
431+
break
432+
if getattr(f, "f_code", None) is None:
433+
break
434+
frames.append((f, lineno))
435+
f = getattr(f, "f_back", None)
436+
stack = tb_StackSummary.extract(frames,
428437
limit=DEBUG_STACK_DEPTH,
429438
lookup_lines=False)
430439
finally:

0 commit comments

Comments
 (0)