mirror of
https://github.com/cool-RR/PySnooper.git
synced 2026-01-23 10:15:11 +00:00
Modify depth to depth_iterator to support float('inf') and also break if _frame_candidate is internal_frame
This commit is contained in:
parent
caf4ec584a
commit
b9f35dbcb2
1 changed files with 4 additions and 1 deletions
|
|
@ -403,10 +403,13 @@ class Tracer:
|
|||
return None
|
||||
else:
|
||||
_frame_candidate = frame
|
||||
for i in range(1, self.depth):
|
||||
depth_iterator = itertools.count(1) if (self.depth == float('inf')) else range(1, self.depth)
|
||||
for i in depth_iterator:
|
||||
_frame_candidate = _frame_candidate.f_back
|
||||
if _frame_candidate is None:
|
||||
return None
|
||||
elif self._is_internal_frame(_frame_candidate):
|
||||
return None
|
||||
elif _frame_candidate.f_code in self.target_codes or _frame_candidate in self.target_frames:
|
||||
break
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue