Jayanth Raman added the comment:
Thanks for the "interact" tip.
FWIW, I see this issue in 2.7.10 as well. Although the list comprehension
works.
$ python
Python 2.7.10 (default, Oct 6 2017, 22:29:07)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin
Type "help",
Karthikeyan Singaravelan added the comment:
Thanks for the report. This seems related to issue21161 and issue26072 that
contain explanation about scope where exec is called with the code and patches
that fix this issue. As a possible workaround in the issues you can use
"interact" command
New submission from Jayanth Raman :
I get a NameError for a variable in the generator param of a function or in a
list comprehension. See example below. The variable is available to the
program, but not to the interactive Pdb shell.
# Test file:
def main(nn=10):
xx = list(range(nn))