def check_stack_size(self, code):
    if isinstance(code, str):
        code = compile(code, '<foo>', 'single')
    max_size = math.ceil(math.log(len(code.co_code)))
    self.assertLessEqual(code.co_stacksize, max_size)
def check_stack_size(self, code):
    if isinstance(code, str):
        code = compile(code, '<foo>', 'single')
    max_size = math.ceil(math.log(len(code.co_code)))
    self.assertLessEqual(code.co_stacksize, max_size)