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

Function get_events

Lib/test/support/strace_helper.py:147–164  ·  view source on GitHub ↗
(code, strace_flags, prelude, cleanup)

Source from the content-addressed store, hash-verified

145
146
147def get_events(code, strace_flags, prelude, cleanup):
148 # NOTE: The flush is currently required to prevent the prints from getting
149 # buffered and done all at once at exit
150 prelude = textwrap.dedent(prelude)
151 code = textwrap.dedent(code)
152 cleanup = textwrap.dedent(cleanup)
153 to_run = f"""
154print("MARK prelude", flush=True)
155{prelude}
156print("MARK code", flush=True)
157{code}
158print("MARK cleanup", flush=True)
159{cleanup}
160print("MARK __shutdown", flush=True)
161 """
162 trace = strace_python(to_run, strace_flags)
163 all_sections = trace.sections()
164 return all_sections['code']
165
166
167def get_syscalls(code, strace_flags, prelude="", cleanup="",

Callers 1

get_syscallsFunction · 0.85

Calls 3

strace_pythonFunction · 0.85
dedentMethod · 0.45
sectionsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…