[issue26072] pdb fails to access variables closed over

2016-11-22 Thread Chun-Yu Tseng
Chun-Yu Tseng added the comment: Hey xdegaye, have you confirmed it? -- ___ Python tracker ___ ___

[issue26072] pdb fails to access variables closed over

2016-11-16 Thread Chun-Yu Tseng
Chun-Yu Tseng added the comment: Your solution is quite neat. But it still misses use cases of the `global` statement: 1 y = 2 2 3 def f(): 4 y = 9 5 -> import pdb; pdb.set_trace(); 6 7 f() (Pdb) global y; y 9 (Pdb) global y; y += 1; y 10 (Pdb)

[issue26072] pdb fails to access variables closed over

2016-11-16 Thread Xavier de Gaye
Xavier de Gaye added the comment: This patch fixes the problems raised in this issue and allows accessing the globals at the Pdb prompt with the globals() dictionary: (Pdb) list 1 y = 2 2 3 def f(): 4 y = 9 5 z = 10 6 -> import pdb; pdb.set_trace(); 7

[issue26072] pdb fails to access variables closed over

2016-11-16 Thread Chun-Yu Tseng
Chun-Yu Tseng added the comment: The last patch in #21161 fixes some problems but also brings up critical issues: (Pdb) list . 1 y = 2 2 3 def f(): 4 y = 9 5 z = 10 6 -> import pdb; pdb.set_trace(); 7 f() [EOF] (Pdb) globals()['y'] 9 (Pdb)

[issue26072] pdb fails to access variables closed over

2016-11-16 Thread Xavier de Gaye
Xavier de Gaye added the comment: It seems that the last patch in issue 21161 fixes all the problems described here, msg 149096 explains why. Can you confirm that this is a duplicate of issue 21161. -- ___ Python tracker

[issue26072] pdb fails to access variables closed over

2016-11-15 Thread Antony Lee
Changes by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker ___ ___

[issue26072] pdb fails to access variables closed over

2016-11-15 Thread Chun-Yu Tseng
Chun-Yu Tseng added the comment: Call for review again. Maybe xdegaye would like to take a look? I found this related issue: #21161 -- ___ Python tracker

[issue26072] pdb fails to access variables closed over

2016-10-16 Thread Chun-Yu Tseng
Chun-Yu Tseng added the comment: Surrender. After digging into the implementation of how CPython handles closures, I am sure that it is impossible to solve this problem now correctly. What I can do is create a patch to let Pdb print enough information when the problem occurs. It would look

[issue26072] pdb fails to access variables closed over

2016-09-27 Thread Chun-Yu Tseng
Chun-Yu Tseng added the comment: What Antony Lee mentioned are two different cases. The former is what PDB should behave because it is not reasonable to inspect a variable does not exist in the current frame. If you want to do so, you have to reference the variable `x` as a closure inside

[issue26072] pdb fails to access variables closed over

2016-09-21 Thread Jesús Gómez
Jesús Gómez added the comment: Confirming. Another use case is the use any lambda, or function definition inside the scope of a function, for checking conditions in the REPL. Suppose two inner functions named condition1 and condition2, and a parameter X as a Collection: (Pdb)

[issue26072] pdb fails to access variables closed over

2016-01-15 Thread SilentGhost
Changes by SilentGhost : -- nosy: +georg.brandl type: -> behavior ___ Python tracker ___

[issue26072] pdb fails to access variables closed over

2016-01-09 Thread Antony Lee
New submission from Antony Lee: Consider the following example: def f(x=1): def g(): y = 2 raise Exception g() f() $ python -mpdb -ccontinue example.py <... traceback ...> > /tmp/example.py(4)g() -> raise Exception (Pdb) p x # this can be