This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alex_nanou
Recipients
Date 2002-03-10.23:38:07
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Bug confirmed.

description:
names that a in a scope just above the scome of the 
nested block (function) do not appear that functions 
globals thus bracking SOME (!) of the code that uses 
them. in particular the eval function, and all code 
that explicitly searces the name in the globals.

code:
//see the attached file.

output:
- a NameError raised in function nested_1:
'NameError: global name 'a' is not defined'
- a NameError raised in function nested_2:
'NameError: name 'a' is not defined'

workarround:
explicitly pass the variable to the function as its 
default argument (as in nested_0).
NOTE: declaring the name global does not work (as 
shown in function nested_1).
//see the attached file for more details.

test results:
 there appears to be a gap between the globals and the 
locals of a nested function.

test systems:
WIN2K v.5.00.2195 SP2
- ActivePython 2.2 Alpha 2 build 1 (ActiveState) 
Python 2.2a2+ (#22, Sep  5 2001, 14:10:41) [MSC 32 bit 
(Intel)] on win32
- Python 2.2 (#1, Dec 31 2001, 15:21:18) [GCC 2.95.3-5 
(cygwin special)] on cygwin
FreeBSD 4.5 (LocalBuild)
Python2.2 //I do not remember the exact build.

                                       With Respect..
                                             Alex.
History
Date User Action Args
2007-08-23 13:59:40adminlinkissue528274 messages
2007-08-23 13:59:40admincreate