Skip to content

Commit

Permalink
Fixes for new typeguard
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmojaki committed Sep 30, 2023
1 parent bc9281c commit 7518004
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions stack_data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,13 @@ def is_frame(frame_or_tb: Union[FrameType, TracebackType]) -> bool:


def iter_stack(frame_or_tb: Union[FrameType, TracebackType]) -> Iterator[Union[FrameType, TracebackType]]:
while frame_or_tb:
yield frame_or_tb
if is_frame(frame_or_tb):
frame_or_tb = frame_or_tb.f_back
current: Union[FrameType, TracebackType, None] = frame_or_tb
while current:
yield current
if is_frame(current):
current = current.f_back
else:
frame_or_tb = frame_or_tb.tb_next
current = current.tb_next


def frame_and_lineno(frame_or_tb: Union[FrameType, TracebackType]) -> Tuple[FrameType, int]:
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import pyximport
from typeguard.importhook import install_import_hook
from typeguard import install_import_hook

pyximport.install(language_level=3)

Expand Down

0 comments on commit 7518004

Please sign in to comment.