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

Function check_stack_size

Lib/test/test_compile.py:2574–2580  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

2572 N = 100
2573
2574 def check_stack_size(self, code):
2575 # To assert that the alleged stack size is not O(N), we
2576 # check that it is smaller than log(N).
2577 if isinstance(code, str):
2578 code = compile(code, "<foo>", "single")
2579 max_size = math.ceil(math.log(len(code.co_code)))
2580 self.assertLessEqual(code.co_stacksize, max_size)
2581
2582 def test_and(self):
2583 self.check_stack_size("x and " * self.N + "x")

Callers

nothing calls this directly

Calls 8

getvalueMethod · 0.95
compile_snippetFunction · 0.85
setFunction · 0.85
assertLessEqualMethod · 0.80
disMethod · 0.80
compileFunction · 0.50
logMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…