MCPcopy Index your code
hub / github.com/python/cpython / _iter_stacks

Method _iter_stacks

Lib/profiling/sampling/collector.py:118–127  ·  view source on GitHub ↗

Yield (frames, thread_id) for all stacks, handling both sync and async modes.

(self, stack_frames, skip_idle=False)

Source from the content-addressed store, hash-verified

116 yield from self._build_linear_stacks(leaf_task_ids, task_map, child_to_parent)
117
118 def _iter_stacks(self, stack_frames, skip_idle=False):
119 """Yield (frames, thread_id) for all stacks, handling both sync and async modes."""
120 if stack_frames and hasattr(stack_frames[0], "awaited_by"):
121 for frames, thread_id, _ in self._iter_async_frames(stack_frames):
122 if frames:
123 yield frames, thread_id
124 else:
125 for frames, thread_id in self._iter_all_frames(stack_frames, skip_idle=skip_idle):
126 if frames:
127 yield frames, thread_id
128
129 def _build_task_graph(self, awaited_info_list):
130 task_map = {}

Callers 2

collectMethod · 0.80
collectMethod · 0.80

Calls 2

_iter_async_framesMethod · 0.95
_iter_all_framesMethod · 0.95

Tested by

no test coverage detected