@@ -1626,19 +1626,24 @@ private module Input implements InputSig1, InputSig2 {
16261626 n = any ( Ast:: AssertStmt a ) .getTest ( )
16271627 }
16281628
1629+ predicate postOrInOrder ( Ast:: AstNode n ) { mayThrow ( n ) }
1630+
16291631 private string assertThrowTag ( ) { result = "[assert-throw]" }
16301632
16311633 /**
16321634 * Holds if the expression node `e` may raise an exception at runtime as part of
16331635 * its normal evaluation (not via an explicit `raise`/`assert`, which are
16341636 * modeled separately).
16351637 *
1636- * The set mirrors what the legacy CFG used to flag implicitly: function
1638+ * `TypeError` is intentionally excluded along with exceptions thrown by dunder
1639+ * implementations to avoid cluttering the CFG; we expect user code to catch
1640+ * these only rarely.
1641+ *
1642+ * Otherwise, the set mirrors what the legacy CFG used to flag implicitly: function
16371643 * calls (anything can raise), attribute access (`AttributeError`),
1638- * subscript access (`IndexError`/`KeyError`/`TypeError`), arithmetic and
1639- * comparison operators (`TypeError`/`ZeroDivisionError`), imports
1644+ * subscript access (`IndexError`/`KeyError`), division (`ZeroDivisionError`), imports
16401645 * (`ImportError`/`ModuleNotFoundError`), and generator/coroutine
1641- * suspension points (`await`/`yield`/`yield from`).
1646+ * suspension points (`await`/`yield`/`yield from` throwing `CancelledError` or `GeneratorExit` ).
16421647 *
16431648 * Bare `Name` reads are intentionally excluded — modeling every name
16441649 * read as `mayThrow` would explode CFG edge count for negligible
@@ -1652,11 +1657,7 @@ private module Input implements InputSig1, InputSig2 {
16521657 or
16531658 e instanceof Py:: Subscript
16541659 or
1655- e instanceof Py:: BinaryExpr
1656- or
1657- e instanceof Py:: UnaryExpr
1658- or
1659- e instanceof Py:: Compare
1660+ e .( Py:: BinaryExpr ) .getOp ( ) instanceof Py:: Div
16601661 or
16611662 e instanceof Py:: ImportExpr
16621663 or
0 commit comments