Skip to content

Conversation

tausbn
Copy link
Contributor

@tausbn tausbn commented Apr 26, 2022

I'm still not convinced that this is the best solution, but it fixes the
issue in the short term. When we eventually clean up the whole
EssaNode business, we can consider whether there's a better way to do
this.


I don't think this requires a change note, but will happily add one if needed.

@tausbn tausbn requested a review from a team as a code owner April 26, 2022 20:21
@tausbn tausbn added the no-change-note-required This PR does not need a change note label Apr 26, 2022
@yoff
Copy link
Contributor

yoff commented Apr 27, 2022

Ideally, we would add a test showing the missed flow and then see the situation improve by the widened attribute write.

@tausbn
Copy link
Contributor Author

tausbn commented Apr 27, 2022

Ideally, we would add a test showing the missed flow and then see the situation improve by the widened attribute write.

Ah, good point. I'll add one.

@tausbn tausbn force-pushed the python-add-global-attribute-writes branch from 9dee4a0 to f71cf2e Compare April 27, 2022 15:48
Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one of the tests confusing, otherwise this looks fine to me.

Comment on lines +64 to +65
def test_local_attribute_read():
x = local_var.foo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we testing here? That local_var is different from the one defined in the assignment test?
Perhaps add a comment to explain our expectations. Or perhaps assign to the variable inside the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent was to show that even though we have an attribute assignment to a (local) variable that shadows a global of the same name, this does not result in additional flow. I can add global local_var if you think that'll make it clearer (though it is redundant). Assigning to the variable inside the function would make it a local variable, which would prevent the ModuleVariableNode from even existing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the shadowing is an extra twist.

…sts.py

Co-authored-by: Taus <tausbn@github.com>
@yoff yoff self-requested a review May 2, 2022 09:37
Copy link
Contributor

@yoff yoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tausbn tausbn merged commit 231def0 into github:main May 2, 2022
@tausbn tausbn deleted the python-add-global-attribute-writes branch May 2, 2022 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants