Skip to content

Commit

Permalink
Make extract_stack resilient to lacking frames. (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhance authored Oct 7, 2023
1 parent 1dd40f1 commit 0687643
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion uvloop/cbhandles.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,12 @@ cdef extract_stack():
"""Replacement for traceback.extract_stack() that only does the
necessary work for asyncio debug mode.
"""
f = sys_getframe()
try:
f = sys_getframe()
# sys._getframe() might raise ValueError if being called without a frame, e.g.
# from Cython or similar C extensions.
except ValueError:
return None
if f is None:
return

Expand Down

0 comments on commit 0687643

Please sign in to comment.