[issue5215] change value of local variable in debug

2019-04-23 Thread daniel hahler


daniel hahler  added the comment:

This works however (Python 3.7), but is just buggy in pdbpp (another project).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5215] change value of local variable in debug

2019-04-23 Thread daniel hahler


daniel hahler  added the comment:

@Andrei
That is something different, caused by "y" only being defined later.
But it would be nice if it would work.  Should be a separate/new issue though.

--
nosy: +blueyed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5215] change value of local variable in debug

2016-12-29 Thread Андрей Бодров

Андрей Бодров added the comment:

I still can reproduce this bug, is that intended behavior?
  1 def func():
  2   import pdb; pdb.set_trace()
  3   x = 0
  4   y = 0
  5   z = 0
  6 
  7 if __name__ == "__main__":
  8   func()

> /test.py(3)func()
-> x = 0
(Pdb) n
> /test.py(4)func()
-> y = 0
(Pdb) x = 5
(Pdb) y = 3
(Pdb) j 5
> /test.py(5)func()
-> z = 0
(Pdb) x
0
(Pdb) y
*** NameError: name 'y' is not defined

--
nosy: +Андрей Бодров
versions: +Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5215] change value of local variable in debug

2010-08-18 Thread Markus Pröller

Markus Pröller mproel...@googlemail.com 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 filename
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 rep...@bugs.python.org
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

2010-08-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Ah, the patch is buggy; it was corrected with r71019 which indeed fixes up 
and down. You could try to apply this change to your local copy.

Also consider upgrading to 2.7, where everything works as expected...

--

___
Python tracker rep...@bugs.python.org
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

2010-08-18 Thread Markus Pröller

Markus Pröller mproel...@googlemail.com 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 rep...@bugs.python.org
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

2010-08-18 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Right, this last problem still exists with 2.7 or 3.1. Please open a new 
tracker item for it, and let's close this one.

--

___
Python tracker rep...@bugs.python.org
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

2010-08-17 Thread Markus Pröller

Markus Pröller mproel...@googlemail.com 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 rep...@bugs.python.org
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

2010-08-17 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

 In the meantime I have switched to Python 2.6.5,
 but the problem that I described above is still there.
The fix was made for 2.7, and not backported to 2.6.

 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).
This is not my experience: the variables of the current frame are available. 
What did you do exactly?

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
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

2009-04-02 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Committed in r71006.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
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

2009-04-01 Thread Maru Newby

Maru Newby mne...@thesprawl.net added the comment:

Modifications to the f_locals dict are only saved at the end of
traceback, and each traceback function was using the f_locals accessor
that returns the dict state as of the start of traceback.  The provided
patch caches f_locals on setup and ensures that all traceback functions
share that cached dict, ensuring that modifications are no longer
overwritten by a function using the unmodified dict.

--
keywords: +patch
nosy: +maru
Added file: http://bugs.python.org/file13561/pdb_cache_f_locals.patch

___
Python tracker rep...@bugs.python.org
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

2009-02-12 Thread mproeller

mproeller mproel...@googlemail.com added the comment:

This is the pdb session at the tracepoint in line 4 in the function func
()
So I did the following first:

 c:\test.py(5)func()
- a = b + 2
(Pdb) p b
13
(Pdb) !b=5
(Pdb) p b
13
(Pdb) n
 c:\test.py(6)func()
- print a
(Pdb) n
15

I tried to change the value of b but it didn't work, as the
print a statement printed 15, but it should have printed 7
because I set b to 5!!
Then I did the same again:

 c:\test.py(5)func()
- a = b + 2
(Pdb) p b
13
(Pdb) !b = 5
(Pdb) n
 c:\test.py(6)func()
- print a
(Pdb) n
7

Note that I changed the value of b to 5 and than didn't print the value
of b and it seems to work as the print statement printed 7.

___
Python tracker rep...@bugs.python.org
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

2009-02-11 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Could you describe the problem in more detail please? I've having
trouble understanding you description. For example, you could you paste
the pdb session you used and explain what you expected?

--
nosy: +benjamin.peterson

___
Python tracker rep...@bugs.python.org
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

2009-02-10 Thread mproeller

New submission from mproeller mproel...@googlemail.com:

The following code produces problems:

import pdb
def func():
b = 13
pdb.set_trace()
a = b + 2
print a
func()

If I change the value of b (e.g. to 3) everything works fine
(print a = displays 5)
but if I want to change b (e.g. to 3) and display the value,
it is reset to 13
(and print a displays 15)

--
components: None
messages: 81631
nosy: mproeller
severity: normal
status: open
title: change value of local variable in debug
type: behavior
versions: Python 2.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com