Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions python/ql/lib/semmle/python/controlflow/internal/AstNodeImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1633,21 +1633,21 @@ private module Input implements InputSig1, InputSig2 {
* its normal evaluation (not via an explicit `raise`/`assert`, which are
* modeled separately).
*
* The set mirrors what the legacy CFG used to flag implicitly: function
* calls (anything can raise), attribute access (`AttributeError`),
* subscript access (`IndexError`/`KeyError`/`TypeError`), arithmetic and
* comparison operators (`TypeError`/`ZeroDivisionError`), imports
* (`ImportError`/`ModuleNotFoundError`), and generator/coroutine
* suspension points (`await`/`yield`/`yield from`).
* This experimental DCA variant excludes ordinary function calls to measure
* the performance and precision cost of conservatively treating every call
* as potentially throwing. Other implicit exception sources remain modeled:
* attribute access (`AttributeError`), subscript access
* (`IndexError`/`KeyError`/`TypeError`), arithmetic and comparison operators
* (`TypeError`/`ZeroDivisionError`), imports
* (`ImportError`/`ModuleNotFoundError`), and generator/coroutine suspension
* points (`await`/`yield`/`yield from`).
*
* Bare `Name` reads are intentionally excluded — modeling every name
* read as `mayThrow` would explode CFG edge count for negligible
* analysis value. `BoolExpr`/`IfExp` containers are also excluded; the
* operands they evaluate contribute their own exception edges.
*/
private predicate exprMayThrow(Py::Expr e) {
e instanceof Py::Call
or
e instanceof Py::Attribute
or
e instanceof Py::Subscript
Expand Down