Issue 926807: pdb sometimes sets breakpoints in the wrong location (original) (raw)
If one attempts to set a breakpoint in one line function: e.g for this code:
def f(x): return x*x
z=23
pdb silently sets a breakpoint on the line right after the function definition (i.e. outside the function body!):
../python pdb.py.v1.66 pdb_one_line_func
(1)?() (Pdb) b f Breakpoint 1 /src/Lib/pdb_one_line_func:3 (Pdb) c /src/Lib/pdb_one_line_func(3)?() -> z=23
It's probably acceptable to limit pdb breakpoints to multiline functions, but i don't think, it's acceptable to create wrong breakpoints.
Note: that anyone attempting to fix this should also take a look at bug 875404 (global statment causes breakpoints..), as both bugs are caused by pdb.checkline() logic