[issue5215] change value of local variable in debug
Markus Pröller added the comment: Hello, I have tested this patch since a while. In the meantime I have switched to Python 2.6.5, but the problem that I described above is still there. Another problem that brought the patch is, that when I move a frame up in the stack trace, the variables of the current stack are not available any more (only the variables of the newest frame are available). -- components: -None nosy: +Markus.Pröller versions: +Python 2.6 -Python 2.5 ___ Python tracker <http://bugs.python.org/issue5215> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5215] change value of local variable in debug
Markus Pröller added the comment: Hello, I changed pdb.py to the file I added in the attachment (I just used the given patch pdb_cache_f_locals.patch) Then I created the following file: import pdb def function_1(number): stack_1 = number function_2(stack_1) def function_2(number): stack_2 = number + 1 function_3(stack_2) def function_3(number): stack_3 = number + 1 pdb.set_trace() print stack_3 function_1(1) and run that file with python -i This is my python version: --- Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> - And here is what I did in the pdb session: > c:\tst_pdb.py(14)function_3() -> print stack_3 (Pdb) !print stack_3 3 (Pdb) u > c:\tst_pdb.py(9)function_2() -> function_3(stack_2) (Pdb) l 4 stack_1 = number 5 function_2(stack_1) 6 7 def function_2(number): 8 stack_2 = number + 1 9 -> function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 print stack_3 (Pdb) !print stack_2 *** NameError: name 'stack_2' is not defined (Pdb) d > c:\tst_pdb.py(14)function_3() -> print stack_3 (Pdb) l 9 function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 -> print stack_3 15 16 function_1(1) [EOF] (Pdb) !stack_3 = 125 #this works now with the patch (Pdb) !print stack_3 125 (Pdb) When I use my original pdb.py, I can print variable stack_2 when I move one frame up, but can't change the value of these local variables. -- Added file: http://bugs.python.org/file18563/pdb.py ___ Python tracker <http://bugs.python.org/issue5215> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5215] change value of local variable in debug
Markus Pröller added the comment: Okay, thanks for giving me the correct patch, but I still face the following problem (with the same code snippet): > c:\tst_pdb.py(14)function_3() -> print stack_3 (Pdb) l 9 function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 -> print stack_3 15 16 function_1(1) [EOF] (Pdb) stack_3 3 (Pdb) !stack_3 = 177 (Pdb) !print stack_3 177 (Pdb) u > c:\tst_pdb.py(9)function_2() -> function_3(stack_2) (Pdb) l 4 stack_1 = number 5 function_2(stack_1) 6 7 def function_2(number): 8 stack_2 = number + 1 9 -> function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 print stack_3 (Pdb) !print stack_2 2 (Pdb) !stack_2 = 144 (Pdb) !print stack_2 144 (Pdb) d > c:\tst_pdb.py(14)function_3() -> print stack_3 (Pdb) l 9 function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 -> print stack_3 15 16 function_1(1) [EOF] (Pdb) stack_3 3 (Pdb) u > c:\tst_pdb.py(9)function_2() -> function_3(stack_2) (Pdb) !print stack_2 2 (Pdb) I set the value of stack_3 to 177, go one frame up, do something, go one frame down and stack_3 is 3 again (not 177 as expected) -- ___ Python tracker <http://bugs.python.org/issue5215> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9633] pdb go stack up/down
New submission from Markus Pröller : Hello, with python 2.7 I encounter the following problem: I have created the following sample script: import pdb def function_1(number): stack_1 = number function_2(stack_1) def function_2(number): stack_2 = number + 1 function_3(stack_2) def function_3(number): stack_3 = number + 1 pdb.set_trace() print stack_3 function_1(1) This is what I have done in the pdb session: > c:\tst_pdb.py(14)function_3() -> print stack_3 (Pdb) l 9 function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 -> print stack_3 15 16 function_1(1) [EOF] (Pdb) stack_3 3 (Pdb) !stack_3 = 177 (Pdb) !print stack_3 177 (Pdb) u > c:\tst_pdb.py(9)function_2() -> function_3(stack_2) (Pdb) l 4 stack_1 = number 5 function_2(stack_1) 6 7 def function_2(number): 8 stack_2 = number + 1 9 -> function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 print stack_3 (Pdb) !print stack_2 2 (Pdb) !stack_2 = 144 (Pdb) !print stack_2 144 (Pdb) d > c:\tst_pdb.py(14)function_3() -> print stack_3 (Pdb) l 9 function_3(stack_2) 10 11 def function_3(number): 12 stack_3 = number + 1 13 pdb.set_trace() 14 -> print stack_3 15 16 function_1(1) [EOF] (Pdb) stack_3 3 (Pdb) u > c:\tst_pdb.py(9)function_2() -> function_3(stack_2) (Pdb) !print stack_2 2 (Pdb) I walked through the stack and changed the values of the variables stack_x but the values weren't saved when I moved one frame up/down -- components: Library (Lib) messages: 114213 nosy: Markus.Pröller priority: normal severity: normal status: open title: pdb go stack up/down type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue9633> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com