New submission from Xavier de Gaye:

With the following pdb_jump.py script:

def foo(x):
    import pdb; pdb.set_trace()
    lineno = 3
    lineno = 4

foo(1)


The change made to 'x' is lost after a jump to line 4:

$ ./python ~/tmp/test/pdb_jump.py
> ~/tmp/test/pdb_jump.py(3)foo()
-> lineno = 3
(Pdb) x = 123
(Pdb) jump 4
> ~/tmp/test/pdb_jump.py(4)foo()
-> lineno = 4
(Pdb) x
1
(Pdb)


The problem is that the Bdb format_stack_entry() method refers to 
frame.f_locals and thus overwrites the changes made to the f_locals dictionary 
as the f_locals dictionary is updated from the actual frame locals whenever the 
f_locals accessor is called as stated in a comment of the Pdb setup() method.

----------
components: Library (Lib)
messages: 228783
nosy: georg.brandl, xdegaye
priority: normal
severity: normal
status: open
title: local variable changes lost after pdb jump command
type: behavior
versions: Python 3.4, Python 3.5

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

Reply via email to