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

Function compile_pattern_with_fast_locals

Lib/test/test_peepholer.py:18–29  ·  view source on GitHub ↗
(pattern)

Source from the content-addressed store, hash-verified

16
17
18def compile_pattern_with_fast_locals(pattern):
19 source = textwrap.dedent(
20 f"""
21 def f(x):
22 match x:
23 case {pattern}:
24 pass
25 """
26 )
27 namespace = {}
28 exec(source, namespace)
29 return namespace["f"].__code__
30
31
32def count_instr_recursively(f, opname):

Calls 1

dedentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…