Skip to content

Commit 93fcaf2

Browse files
committed
python: RaisingTuple.ql to not use poins-to
Use local dataflow instead and simply check for tuple literals.
1 parent 2223bc3 commit 93fcaf2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/ql/src/Exceptions/RaisingTuple.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
*/
1111

1212
import python
13+
import semmle.python.dataflow.new.DataFlow
1314

14-
from Raise r, Value v, AstNode origin
15+
from Raise r, DataFlow::LocalSourceNode origin
1516
where
16-
r.getException().pointsTo(v, origin) and
17-
v.getClass() = ClassValue::tuple() and
17+
exists(DataFlow::Node exception | exception.asExpr() = r.getException() |
18+
origin.flowsTo(exception)
19+
) and
20+
origin.asExpr() instanceof Tuple and
1821
major_version() = 2
1922
/* Raising a tuple is a type error in Python 3, so is handled by the IllegalRaise query. */
2023
select r,

0 commit comments

Comments
 (0)