MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_stack_size

Function check_stack_size

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

Source from the content-addressed store, hash-verified

2553 N = 100
2554
2555 def check_stack_size(self, code):
2556 # To assert that the alleged stack size is not O(N), we
2557 # check that it is smaller than log(N).
2558 if isinstance(code, str):
2559 code = compile(code, "<foo>", "single")
2560 max_size = math.ceil(math.log(len(code.co_code)))
2561 self.assertLessEqual(code.co_stacksize, max_size)
2562
2563 def test_and(self):
2564 self.check_stack_size("x and " * self.N + "x")

Callers

nothing calls this directly

Calls 10

getvalueMethod · 0.95
isinstanceFunction · 0.85
lenFunction · 0.85
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