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

Function compile_snippet

Lib/test/test_compile.py:2650–2659  ·  view source on GitHub ↗
(i)

Source from the content-addressed store, hash-verified

2648
2649 def check_stack_size(self, snippet, async_=False):
2650 def compile_snippet(i):
2651 ns = {}
2652 script = """def func():\n""" + i * snippet
2653 if async_:
2654 script = "async " + script
2655 with warnings.catch_warnings():
2656 warnings.simplefilter('ignore', SyntaxWarning)
2657 code = compile(script, "<script>", "exec")
2658 exec(code, ns, ns)
2659 return ns['func'].__code__
2660
2661 sizes = [compile_snippet(i).co_stacksize for i in range(2, 5)]
2662 if len(set(sizes)) != 1:

Callers 1

check_stack_sizeFunction · 0.85

Calls 1

compileFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…