From 75180041dce756427fb59800c67c11bb74a80a37 Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Sat, 30 Sep 2023 13:07:26 +0200 Subject: [PATCH] Fixes for new typeguard --- stack_data/utils.py | 11 ++++++----- tests/__init__.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/stack_data/utils.py b/stack_data/utils.py index 78ce2d6..ad8cd38 100644 --- a/stack_data/utils.py +++ b/stack_data/utils.py @@ -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]: diff --git a/tests/__init__.py b/tests/__init__.py index fe28111..aa63d95 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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)