diff options
| author | bd <bdunahu@operationnull.com> | 2025-07-29 23:05:56 -0400 |
|---|---|---|
| committer | bd <bdunahu@operationnull.com> | 2025-07-29 23:05:56 -0400 |
| commit | 003a949377df6b639d70aacf9f452608a0b0e7a8 (patch) | |
| tree | a49785495d27d60f64ff77844d94f52c5b32e84a | |
| parent | f97a07d6838e92967c55d2314cf3699a7d26c3cf (diff) | |
Update comment on _get_deepest_tracable_frame
| -rwxr-xr-x | aergia/aergia.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/aergia/aergia.py b/aergia/aergia.py index efc68e2..501a3ae 100755 --- a/aergia/aergia.py +++ b/aergia/aergia.py @@ -301,9 +301,17 @@ class Aergia(object): @staticmethod def _get_deepest_traceable_frame(coro): '''Get the deepest frame of coro we care to trace. - Since coro is a suspended task, we know that the frame we are - looking for belongs to a COROUTINE. Else, it cannot be the case - it is suspended.''' + Luckily for us, coroutines keep track of the coroutine object which + they are waiting on (cr_await). We simply need to trace that down as far + as possible to get the actual line we are waiting on. + Note that it cannot be the case that a task is not suspended in a frame + that does not belong to a coroutine, asyncio is very particular about + that! + + If cr_await is None, then the task was created but never started. + (since once a task is started, it either starts waiting on another + coroutine, or finishes immediately). These cases were already filtered + out in `_get_idle_task_frames'.''' curr = coro deepest_frame = None while curr: |
