summaryrefslogtreecommitdiff
path: root/aergia
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-07-20 13:43:17 -0600
committerbd <bdunahu@operationnull.com>2025-07-20 13:43:17 -0600
commit1eddfd07cad491ce8d216ee3fda72bdd9ecb9eae (patch)
treeaccdf32e5696d1abe0e1916cffd8b22081b1409e /aergia
parent2e208349d2e6f8f3d7fbbe853413549da9df0ce0 (diff)
Aergia.get_deepest_traceable_frame refactor, tests
Generators and list comprehension gives correct but less ideal results, matching yappi. Can this be improved in the future?
Diffstat (limited to 'aergia')
-rwxr-xr-xaergia/aergia.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/aergia/aergia.py b/aergia/aergia.py
index d8f18ec..83cf0fa 100755
--- a/aergia/aergia.py
+++ b/aergia/aergia.py
@@ -247,20 +247,15 @@ class Aergia(object):
@staticmethod
def get_deepest_traceable_frame(coro):
- if not coro:
- return None
curr = coro
- lframe = None
- while True:
+ ret = None
+ while curr:
frame = getattr(curr, 'cr_frame', None)
- if not frame or not Aergia.should_trace(frame.f_code.co_filename):
- return lframe
-
- lframe = frame
- awaited = getattr(curr, 'cr_await', None)
- if not awaited or not hasattr(awaited, 'cr_frame'):
- return lframe
- curr = awaited
+ # print(frame)
+ if frame and Aergia.should_trace(frame.f_code.co_filename):
+ ret = frame
+ curr = getattr(curr, 'cr_await', None)
+ return ret
@staticmethod
def should_trace(filename):