[issue21161] list comprehensions don't see local variables in pdb in python3
Georg Brandl
report at bugs.python.org
Sat Apr 5 21:33:03 CEST 2014
Georg Brandl added the comment:
Your failure appears to be not pasted from an interpreter session; the actual failure is:
(Pdb) all(x < limit for x in items)
*** NameError: global name 'limit' is not defined
(i.e. "limit" is not found, not "items"). This actually does not work in Python 2 either. What did work in Python 2 and doesn't work in 3, is using a list comprehension like
all([x < limit for x in items])
This is because list comprehensions are now implemented with their own function object like generator expressions have always been. To make the code in pdb compile "as if" it was put in the debugged function will be as good as impossible, so I'm closing this as won't fix.
----------
resolution: -> wont fix
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21161>
_______________________________________
More information about the Python-bugs-list
mailing list