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

Function always_exits

Tools/cases_generator/analyzer.py:819–842  ·  view source on GitHub ↗
(op: parser.CodeDef)

Source from the content-addressed store, hash-verified

817
818
819def always_exits(op: parser.CodeDef) -> bool:
820 depth = 0
821 tkn_iter = iter(op.tokens)
822 for tkn in tkn_iter:
823 if tkn.kind == "LBRACE":
824 depth += 1
825 elif tkn.kind == "RBRACE":
826 depth -= 1
827 elif depth > 1:
828 continue
829 elif tkn.kind == "GOTO" or tkn.kind == "RETURN":
830 return True
831 elif tkn.kind == "KEYWORD":
832 if tkn.text in EXITS:
833 return True
834 elif tkn.kind == "IDENTIFIER":
835 if tkn.text in EXITS:
836 return True
837 if tkn.text == "DEOPT_IF" or tkn.text == "ERROR_IF":
838 next(tkn_iter) # '('
839 t = next(tkn_iter)
840 if t.text in ("true", "1"):
841 return True
842 return False
843
844
845def stack_effect_only_peeks(instr: parser.InstDef) -> bool:

Callers 1

compute_propertiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…