diff options
author | Guido van Rossum <guido@python.org> | 1999-11-03 13:10:07 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-11-03 13:10:07 +0000 |
commit | fef4474a07ec29f243508c99f1fa69b87c7d5e25 (patch) | |
tree | 3612418788146158bab3b386d3ac097d5f62700b /Lib/pdb.py | |
parent | f85b8592f2ff64b7a336fa9a27616f96bb722160 (diff) | |
download | cpython-fef4474a07ec29f243508c99f1fa69b87c7d5e25.tar.gz |
Sjoerd Mullender writes:
I regularly find that pdb sets the breakpoint on the wrong line when I
try to set a breakpoint on a function. This fixes the problem
somewhat.
The real problem is that pdb tries to parse the Python source code to
find the first executable line. A better way might be to inspect the
code object, or even have a variable in the code object
co_firstexecutablelineno, but that's too much work.
The patch fixes the problem when the first code line after the def
statement contains the start *and* end of a triple-quoted string. The
code assumed that the end of a triple-quoted string is not on the same
line as the start, and so it would skip to the end of the *next*
triple-quoted string.
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-x | Lib/pdb.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py index b897efb633..63c7c1dd2d 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -346,6 +346,9 @@ class Pdb(bdb.Bdb, cmd.Cmd): if len(line) >= 3: if (line[:3] == '"""' or line[:3] == "'''"): + if line[-3:] == line[:3]: + # one-line string + continue incomment = line[:3] continue if line[0] != '#': break |