aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/stack-data/stack_data/utils.py
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-10-17 09:40:44 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-10-17 09:57:21 +0300
commit86f79c5885de0ada17ad009a0793fa5335101d5b (patch)
tree03595a8d9ed322bc97de2285263c3ae12606c704 /contrib/python/stack-data/stack_data/utils.py
parent784925324fd115c37bc98c5bbfe64c15f9966d74 (diff)
downloadydb-86f79c5885de0ada17ad009a0793fa5335101d5b.tar.gz
Update contrib/python/stack-data to 0.6.3
Diffstat (limited to 'contrib/python/stack-data/stack_data/utils.py')
-rw-r--r--contrib/python/stack-data/stack_data/utils.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/python/stack-data/stack_data/utils.py b/contrib/python/stack-data/stack_data/utils.py
index 78ce2d60a4..ad8cd38dc4 100644
--- a/contrib/python/stack-data/stack_data/utils.py
+++ b/contrib/python/stack-data/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]: