Message75289
#----------------------------------------------------------------------
VERSION AFFECTED: 2.5 and 2.6
BUILD TYPE: x86
FLAGS PASSED TO PYTHON.EXE: None
OPERATING SYSTEM: 32-bit Windows Vista SP1
#----------------------------------------------------------------------
BRIEF DESCRIPTION:
According to
http://docs.python.org/dev/reference/executionmodel.html#interaction-
with-dynamic-features, a free variable is a variable used from some
local scope that is not defined there. The behavior of Python 2.5/2.6
is that it treats certain Python keywords and builtin types/functions
used in nested scopes as free variables as well. This seems a little
odd.
Could the documentation be clarified to state: usage of certain Python
keywords are considered to be free variables. I.e., a line simply
containing "int" triggers the free variable behavior. Alternatively,
usage of builtin types/functions could be allowed from nested functions
with calls to "exec"…
Thanks,
Dave
#----------------------------------------------------------------------
REPRODUCTION SNIPPET:
def a():
def b():
x = long(3) #Replace me with "x = 3L" and this works
int #This must be commented out
exec ""
emits the following:
File "garbage.py", line 4
exec ""
SyntaxError: unqualified exec is not allowed in function 'b' it is
a nested function
unless the "x = long(3)" and "int" lines are commented out. |
|
Date |
User |
Action |
Args |
2008-10-28 16:19:48 | dfugate | set | recipients:
+ dfugate, georg.brandl |
2008-10-28 16:19:48 | dfugate | set | messageid: <1225210788.32.0.89272753959.issue4220@psf.upfronthosting.co.za> |
2008-10-28 16:19:47 | dfugate | link | issue4220 messages |
2008-10-28 16:19:46 | dfugate | create | |
|