PDB does not allow jumping to first statement?
Peter Otten
__peter__ at web.de
Tue Mar 27 03:46:50 EDT 2007
Duncan Booth wrote:
> "Chris Lasher" <chris.lasher at gmail.com> wrote:
>
>> I noticed that I absolutely cannot jump back to the first statement
>> (line 3, "a = 1") using the jump command. I can jump to any other line
>> BUT the first statement's using the "jump <line number>" command. I
>> experience the same behavior with Winpdb and rpdb2. Why is this?
>>
>
> Which version of Python, and what happens when you try it?
>
> It works fine for me with Python 2.5 on Windows:
>
> C:\Temp>\python25\python -m pdb t.py
>> c:\temp\t.py(3)<module>()
> -> a = 1
> (Pdb) s
>> c:\temp\t.py(4)<module>()
> -> b = 2
> (Pdb) j 3
>> c:\temp\t.py(3)<module>()
> -> a = 1
> (Pdb)
It looks like you successfully jumped to the first line, but it will be
skipped if you try to execute it:
$ cat tmp.py
print "aaa"
print "bbb"
print "ccc"
print "ddd"
$ python2.5 -m pdb tmp.py
> /home/nn/tmp.py(1)<module>()
-> print "aaa"
(Pdb) s
aaa
> /home/nn/tmp.py(2)<module>()
-> print "bbb"
(Pdb) j 1
> /home/nn/tmp.py(1)<module>()
-> print "aaa"
(Pdb) s
bbb <-- wrong
> /home/nn/tmp.py(3)<module>()
-> print "ccc"
(Pdb) s
ccc
> /home/nn/tmp.py(4)<module>()
-> print "ddd"
(Pdb) j 2
> /home/nn/tmp.py(2)<module>()
-> print "bbb"
(Pdb) s
bbb <-- correct
> /home/nn/tmp.py(3)<module>()
-> print "ccc"
Peter
More information about the Python-list
mailing list