Python points-to: Fix up tuple inequality analysis.

This commit is contained in:
Mark Shannon
2019-05-13 12:59:19 +01:00
parent 0491fe1356
commit 26044f20c7
4 changed files with 3 additions and 14 deletions

View File

@@ -1343,9 +1343,9 @@ module Expressions {
or
n = other.length() and n = val.length() and result = 0
or
result != 0 and result = compare_unbound(val.getItem(n), val.getItem(n))
result != 0 and result = compare_unbound(val.getItem(n), other.getItem(n))
or
compare_unbound(val.getItem(n), val.getItem(n)) = 0 and result = compare_sequence(val, other, n+1)
compare_unbound(val.getItem(n), other.getItem(n)) = 0 and result = compare_sequence(val, other, n+1)
)
}

View File

@@ -5,7 +5,7 @@ import semmle.python.pointsto.PointsToContext
from ControlFlowNode f, Location l, Context c
where not PointsTo::Test::reachableBlock(f.getBasicBlock(), c) and c.isImport() and
where not PointsToInternal::reachableBlock(f.getBasicBlock(), c) and c.isImport() and
(f.getNode() instanceof FunctionExpr or f.getNode() instanceof ClassExpr) and
l = f.getLocation() and l.getFile().getName().matches("%test.py")
select l.getStartLine()

View File

@@ -1,3 +0,0 @@
| module.py | 6 | BasicBlock | true |
| test.py | 27 | BasicBlock | true |
| test.py | 41 | BasicBlock | true |

View File

@@ -1,8 +0,0 @@
import python
import semmle.python.types.Version
from VersionGuard vg, Location l, boolean b
where l = vg.getLastNode().getLocation()
and (if vg.isTrue() then b = true else b = false)
select l.getFile().getName(), l.getStartLine(), vg.toString(), b