File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ def is_declared_global(self):
188188 return bool (self .__scope == GLOBAL_EXPLICIT )
189189
190190 def is_local (self ):
191- return bool (self .__flags & DEF_BOUND )
191+ return bool (self .__scope in ( LOCAL , CELL ) )
192192
193193 def is_annotated (self ):
194194 return bool (self .__flags & DEF_ANNOT )
Original file line number Diff line number Diff line change @@ -92,10 +92,14 @@ def test_globals(self):
9292 self .assertTrue (self .spam .lookup ("bar" ).is_declared_global ())
9393 self .assertFalse (self .internal .lookup ("x" ).is_global ())
9494 self .assertFalse (self .Mine .lookup ("instance_var" ).is_global ())
95+ self .assertTrue (self .spam .lookup ("bar" ).is_global ())
9596
9697 def test_local (self ):
9798 self .assertTrue (self .spam .lookup ("x" ).is_local ())
98- self .assertFalse (self .internal .lookup ("x" ).is_local ())
99+ self .assertFalse (self .spam .lookup ("bar" ).is_local ())
100+
101+ def test_free (self ):
102+ self .assertTrue (self .internal .lookup ("x" ).is_free ())
99103
100104 def test_referenced (self ):
101105 self .assertTrue (self .internal .lookup ("x" ).is_referenced ())
Original file line number Diff line number Diff line change 1+ Fix a bug in the :mod: `symtable ` module that was causing incorrectly report
2+ global variables as local. Patch by Pablo Galindo.
You can’t perform that action at this time.
0 commit comments