Skip to content

Commit 0687643

Browse files
authored
Make extract_stack resilient to lacking frames. (#563)
1 parent 1dd40f1 commit 0687643

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

uvloop/cbhandles.pyx

+6-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,12 @@ cdef extract_stack():
414414
"""Replacement for traceback.extract_stack() that only does the
415415
necessary work for asyncio debug mode.
416416
"""
417-
f = sys_getframe()
417+
try:
418+
f = sys_getframe()
419+
# sys._getframe() might raise ValueError if being called without a frame, e.g.
420+
# from Cython or similar C extensions.
421+
except ValueError:
422+
return None
418423
if f is None:
419424
return
420425

0 commit comments

Comments
 (0)