Return the list of stack frames for this task's coroutine. If the coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an ex
(self, *, limit=None)
| 147 | raise RuntimeError('Task does not support set_exception operation') |
| 148 | |
| 149 | def get_stack(self, *, limit=None): |
| 150 | """Return the list of stack frames for this task's coroutine. |
| 151 | |
| 152 | If the coroutine is not done, this returns the stack where it is |
| 153 | suspended. If the coroutine has completed successfully or was |
| 154 | cancelled, this returns an empty list. If the coroutine was |
| 155 | terminated by an exception, this returns the list of traceback |
| 156 | frames. |
| 157 | |
| 158 | The frames are always ordered from oldest to newest. |
| 159 | |
| 160 | The optional limit gives the maximum number of frames to |
| 161 | return; by default all available frames are returned. Its |
| 162 | meaning differs depending on whether a stack or a traceback is |
| 163 | returned: the newest frames of a stack are returned, but the |
| 164 | oldest frames of a traceback are returned. (This matches the |
| 165 | behavior of the traceback module.) |
| 166 | |
| 167 | For reasons beyond our control, only one stack frame is |
| 168 | returned for a suspended coroutine. |
| 169 | """ |
| 170 | return base_tasks._task_get_stack(self, limit) |
| 171 | |
| 172 | def print_stack(self, *, limit=None, file=None): |
| 173 | """Print the stack or traceback for this task's coroutine. |