Message83852
In python 3.0 and 3.1, attempting to access a local variable from within
a list comprehension in a string passed to eval() causes a NameError.
Doesn't seem to be a problem in python 2.6
I have attempted to run the attached test cases (test_eval_comp.py)
using the following builds of python:
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32
Python 3.1a1 (r31a1:70244, Mar 8 2009, 18:15:03) [MSC v.1500 32 bit
(Intel)] on win32
All tests passed with Python 2.6.1. The following five tests failed
with Python 3.0.1 and 3.1a1
EvalWithComprehensionTestCase.test_local_var
NameError: global name 'value' is not defined
EvalWithComprehensionTestCase.test_function_arg
NameError: global name 'value' is not defined
EvalWithComprehensionTestCase.test_self_attrib
NameError: global name 'self' is not defined
ExampleFromDocsTestCase.test_local_var
NameError: global name 'vec1' is not defined
NestedComprehensionExampleFromDocsTestCase.test_local_var
NameError: global name 'mat' is not defined |
|
Date |
User |
Action |
Args |
2009-03-20 03:59:50 | evan.greensmith | set | recipients:
+ evan.greensmith |
2009-03-20 03:59:49 | evan.greensmith | set | messageid: <1237521589.9.0.0850513364759.issue5526@psf.upfronthosting.co.za> |
2009-03-20 03:59:27 | evan.greensmith | link | issue5526 messages |
2009-03-20 03:59:26 | evan.greensmith | create | |
|