@@ -1068,7 +1068,7 @@ def getNodeHandler(self, node_class):
1068
1068
)
1069
1069
return handler
1070
1070
1071
- def handleNodeLoad (self , node ):
1071
+ def handleNodeLoad (self , node , parent ):
1072
1072
name = getNodeName (node )
1073
1073
if not name :
1074
1074
return
@@ -1093,7 +1093,6 @@ def handleNodeLoad(self, node):
1093
1093
continue
1094
1094
1095
1095
if name == 'print' and isinstance (binding , Builtin ):
1096
- parent = self .getParent (node )
1097
1096
if (isinstance (parent , ast .BinOp ) and
1098
1097
isinstance (parent .op , ast .RShift )):
1099
1098
self .report (messages .InvalidPrintSyntax , node )
@@ -1880,7 +1879,7 @@ def NAME(self, node):
1880
1879
"""
1881
1880
# Locate the name in locals / function / globals scopes.
1882
1881
if isinstance (node .ctx , ast .Load ):
1883
- self .handleNodeLoad (node )
1882
+ self .handleNodeLoad (node , self . getParent ( node ) )
1884
1883
if (node .id == 'locals' and isinstance (self .scope , FunctionScope ) and
1885
1884
isinstance (node ._pyflakes_parent , ast .Call )):
1886
1885
# we are doing locals() call in current scope
@@ -2049,7 +2048,7 @@ def CLASSDEF(self, node):
2049
2048
self .addBinding (node , ClassDefinition (node .name , node ))
2050
2049
2051
2050
def AUGASSIGN (self , node ):
2052
- self .handleNodeLoad (node .target )
2051
+ self .handleNodeLoad (node .target , node )
2053
2052
self .handleNode (node .value , node )
2054
2053
self .handleNode (node .target , node )
2055
2054
0 commit comments