Author xdegaye
Recipients Jurko.Gospodnetić, georg.brandl, kay, r.david.murray, xdegaye
Date 2014-04-12.09:28:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397294896.55.0.456711302284.issue21161@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-04-12 09:28:16xdegayesetrecipients: + xdegaye, georg.brandl, r.david.murray, Jurko.Gospodnetić, kay
2014-04-12 09:28:16xdegayesetmessageid: <1397294896.55.0.456711302284.issue21161@psf.upfronthosting.co.za>
2014-04-12 09:28:16xdegayelinkissue21161 messages
2014-04-12 09:28:16xdegayecreate