On 2013-04-11 23:11, Ian Kelly wrote:
On Thu, Apr 11, 2013 at 8:56 AM, <donaldcal...@gmail.com> wrote:
#! /usr/bin/env python3
import pdb
def foo(message):
print(message)
pdb.set_trace()
foo('first call')
foo('second call')
Stick this in an file with execute permission and run it. At the first
breakpoint, the backtrace will be correct. Continue. At the second breakpoint,
a backtrace will show the foo('first call') on the stack when, in fact, the
call came from foo('second call'), as verified by the printed message.
This is what I get using Python 3.3.1 in Windows:
C:\Users\ikelly\Desktop>c:\python33\python python_bug.py
first call
--Return--
c:\users\ikelly\desktop\python_bug.py(7)foo()->None
-> pdb.set_trace()
(Pdb) c
second call
--Return--
c:\users\ikelly\desktop\python_bug.py(7)foo()->None
-> pdb.set_trace()
(Pdb) c
Use `where` to see the problem:
[~/scratch]$ python3.3 pdbbug.py
first call
--Return--
> /Users/rkern/scratch/pdbbug.py(4)foo()->None
-> pdb.set_trace()
(Pdb) where
/Users/rkern/scratch/pdbbug.py(5)<module>()
-> foo('first call')
> /Users/rkern/scratch/pdbbug.py(4)foo()->None
-> pdb.set_trace()
(Pdb) c
second call
--Return--
> /Users/rkern/scratch/pdbbug.py(4)foo()->None
-> pdb.set_trace()
(Pdb) where
/Users/rkern/scratch/pdbbug.py(5)<module>()
-> foo('first call')
> /Users/rkern/scratch/pdbbug.py(4)foo()->None
-> pdb.set_trace()
(Pdb)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
--
http://mail.python.org/mailman/listinfo/python-list