Xavier de Gaye added the comment:

The runcode() method of InteractiveInterpreter in code.py uses the 
'self.locals' dictionary as the 'globals' parameter of the invoked exec() 
function. And the do_interact() method of Pdb instantiates 
InteractiveInterpreter with 'locals' as a merge of the current frame's locals 
and globals dictionary. This explains why the interact command of pdb evaluates 
sucessfully the generator expression: the generator function object is 
evaluated by the interpreter in a frame where 'locals' is NULL (see 
fast_function() in ceval.c) and 'globals' includes now the debugged frame 
locals dictionary.

So a fix for this problem is to have the default() method of pdb be implemented 
in the same manner as do_interact() and the runcode() method of 
InteractiveInterpreter. The attached patch does this.

----------
keywords: +patch
Added file: http://bugs.python.org/file34791/genexp.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21161>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to