Closed
Description
Reproduction steps:
- Save below script as foobar.py
python foobar.py foo bar
- You'll break at function
foo
- Defined a breakpoint at
foobar.py:11
(the first line ofmain()
:for arg in argv:
) - c
- You'll be brought to line 11
- c
- You'll be brought to
/usr/lib/python2.6/bdb.py
at_ste_stopinfo()
, and also see that you now have two breakpoints atfoobar.py:11
- Pressing
s
fourteen times eventually brings you to the correct breakpoint inbar()
The expected behavior is to not display bdb.py, and not create duplicate breakpoints.
Obviously there are other ways to accomplish the desired debugging session, but in a large, complex code base, it is sometimes extremely convenient to have multiple set_trace lines, which may or may not cause set_trace to be called twice.
If you can tell me how to induce this error automatically, I can write a unit test for it, at minimum, and likely produce a patch for the bug as well.
# Script: foobar.py
def foo():
import pudb; pudb.set_trace()
print 'foo'
def bar():
import pudb; pudb.set_trace()
print 'bar'
def main(argv):
for arg in argv:
if arg == 'foo':
foo()
elif arg == 'bar':
bar()
import sys
main(sys.argv)