Skip to content

Commit 7ed50bd

Browse files
committed
Fixed. Actually this was already doing what it should.
1 parent 106a406 commit 7ed50bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

unpythonic/syntax/letdo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,8 @@ def transform(tree, names_in_scope):
475475
# in those parts of code where it is used, so an outer let will
476476
# leave it alone.
477477
if type(tree) is Name and tree.id in rhsnames and tree.id not in names_in_scope:
478-
hasctx = hasattr(tree, "ctx") # macro-created nodes might not have a ctx.
479-
if hasctx and type(tree.ctx) is not Load: # let variables are rebound using <<`, not `=`. # TODO: doesn't work for `:=`, which *is* an assignment. Fix this; needs some changes to `scoped_transform`.
478+
hasctx = hasattr(tree, "ctx") # Macro-created nodes might not have a ctx.
479+
if hasctx and type(tree.ctx) is not Load: # Ignore assignments and deletes.
480480
return tree
481481
attr_node = q[n[f"{envname}.{tree.id}"]]
482482
if hasctx:

0 commit comments

Comments
 (0)