Python: Use AttrRead/AttrWrite for attr read/store steps

Note that this doesn't actually add the desired flow from setattr, due
to missing post-update note. This will be fixed in later commit.
This commit is contained in:
Rasmus Wriedt Larsen
2022-02-02 10:58:19 +01:00
parent 5774459dfb
commit 49b5d60229
2 changed files with 19 additions and 18 deletions

View File

@@ -95,7 +95,7 @@ def test_direct_if_always_assign(cond = True):
def test_getattr():
myobj = MyObj(NONSOURCE)
myobj.foo = SOURCE
SINK(getattr(myobj, "foo")) # $ MISSING: flow
SINK(getattr(myobj, "foo")) # $ flow="SOURCE, l:-1 -> getattr(..)"
def test_setattr():
@@ -110,6 +110,13 @@ def test_setattr_getattr():
SINK(getattr(myobj, "foo")) # $ MISSING: flow
def test_setattr_getattr_overwrite():
myobj = MyObj(NONSOURCE)
setattr(myobj, "foo", SOURCE)
setattr(myobj, "foo", NONSOURCE)
SINK_F(getattr(myobj, "foo"))
def test_constructor_assign():
obj = MyObj(SOURCE)
SINK(obj.foo) # $ flow="SOURCE, l:-1 -> obj.foo"