diff --git a/python/ql/src/semmle/python/pointsto/PointsTo.qll b/python/ql/src/semmle/python/pointsto/PointsTo.qll index 339de512084..716eaea7de9 100644 --- a/python/ql/src/semmle/python/pointsto/PointsTo.qll +++ b/python/ql/src/semmle/python/pointsto/PointsTo.qll @@ -610,7 +610,6 @@ module PointsTo { points_to(obj_node, context, x, icls, _) and (not x instanceof ModuleObject and not x instanceof ClassObject) and not icls.isBuiltin() and - Types::class_has_attribute_bool(icls, name) = false and value = unknownValue() and cls = theUnknownType() and origin = f ) ) diff --git a/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected b/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected index 780529a795d..69d04f16124 100644 --- a/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected +++ b/python/ql/test/library-tests/PointsTo/guarded/PointsTo.expected @@ -61,6 +61,7 @@ | test.py | 408 | ControlFlowNode for x | int 1 | 404 | | test.py | 420 | ControlFlowNode for Attribute | NoneType None | 418 | | test.py | 427 | ControlFlowNode for Attribute | NoneType None | 418 | +| test.py | 435 | ControlFlowNode for y | int 1 | 433 | | type_test.py | 5 | ControlFlowNode for d | Dict | 2 | | type_test.py | 14 | ControlFlowNode for x | int 0 | 11 | | type_test.py | 16 | ControlFlowNode for x | float 1.0 | 11 | diff --git a/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected b/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected index bd9e52a7664..542f7ca864c 100644 --- a/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected +++ b/python/ql/test/library-tests/PointsTo/guarded/PointsToWithType.expected @@ -61,6 +61,7 @@ | test.py | 408 | ControlFlowNode for x | int 1 | builtin-class int | 404 | | test.py | 420 | ControlFlowNode for Attribute | NoneType None | builtin-class NoneType | 418 | | test.py | 427 | ControlFlowNode for Attribute | NoneType None | builtin-class NoneType | 418 | +| test.py | 435 | ControlFlowNode for y | int 1 | builtin-class int | 433 | | type_test.py | 5 | ControlFlowNode for d | Dict | builtin-class dict | 2 | | type_test.py | 14 | ControlFlowNode for x | int 0 | builtin-class int | 11 | | type_test.py | 16 | ControlFlowNode for x | float 1.0 | builtin-class float | 11 | diff --git a/python/ql/test/library-tests/PointsTo/guarded/test.py b/python/ql/test/library-tests/PointsTo/guarded/test.py index ced4edc0b6c..cf5dae58eee 100644 --- a/python/ql/test/library-tests/PointsTo/guarded/test.py +++ b/python/ql/test/library-tests/PointsTo/guarded/test.py @@ -426,3 +426,10 @@ class C(object): else: use(self.x) return lambda : use(self.x) + + +def test_on_unknown_attr(): + e = E() + y = 1 + if e.attr: + use(y) diff --git a/python/ql/test/library-tests/PointsTo/new/PointsToUnknown.expected b/python/ql/test/library-tests/PointsTo/new/PointsToUnknown.expected index 0529792ac07..9ba278992c5 100644 --- a/python/ql/test/library-tests/PointsTo/new/PointsToUnknown.expected +++ b/python/ql/test/library-tests/PointsTo/new/PointsToUnknown.expected @@ -225,3 +225,5 @@ | r_regressions.py:52 | ControlFlowNode for msg | 51 | | r_regressions.py:64 | ControlFlowNode for do_validation | 64 | | r_regressions.py:64 | ControlFlowNode for do_validation() | 64 | +| r_regressions.py:90 | ControlFlowNode for Attribute | 90 | +| r_regressions.py:90 | ControlFlowNode for Attribute() | 90 |