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

Function stmt_escapes

Tools/cases_generator/analyzer.py:885–908  ·  view source on GitHub ↗
(stmt: Stmt)

Source from the content-addressed store, hash-verified

883
884
885def stmt_escapes(stmt: Stmt) -> bool:
886 if isinstance(stmt, BlockStmt):
887 return stmt_list_escapes(stmt.body)
888 elif isinstance(stmt, SimpleStmt):
889 for tkn in stmt.contents:
890 if tkn.text == "DECREF_INPUTS":
891 return True
892 d: dict[SimpleStmt, EscapingCall] = {}
893 escaping_call_in_simple_stmt(stmt, d)
894 return bool(d)
895 elif isinstance(stmt, IfStmt):
896 if stmt.else_body and stmt_escapes(stmt.else_body):
897 return True
898 return stmt_escapes(stmt.body)
899 elif isinstance(stmt, MacroIfStmt):
900 if stmt.else_body and stmt_list_escapes(stmt.else_body):
901 return True
902 return stmt_list_escapes(stmt.body)
903 elif isinstance(stmt, ForStmt):
904 return stmt_escapes(stmt.body)
905 elif isinstance(stmt, WhileStmt):
906 return stmt_escapes(stmt.body)
907 else:
908 assert False, "Unexpected statement type"
909
910def stmt_has_jump_on_unpredictable_path_body(stmts: list[Stmt] | None, branches_seen: int) -> tuple[bool, int]:
911 if not stmts:

Callers 2

stmt_list_escapesFunction · 0.85
compute_propertiesFunction · 0.85

Calls 2

stmt_list_escapesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…