summaryrefslogtreecommitdiffstats
path: root/Lib/bdb.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-30 15:01:23 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-30 15:01:23 (GMT)
commitd2fd4cae8e7a2ebd3e18a6640b4558131b9a0fb7 (patch)
treec8b1b1c55668b18c1bc0432caf972b36b419c06c /Lib/bdb.py
parent6cccb865d1e757b1ddd5ca735cfd5fccc64d501a (diff)
downloadcpython-d2fd4cae8e7a2ebd3e18a6640b4558131b9a0fb7.zip
cpython-d2fd4cae8e7a2ebd3e18a6640b4558131b9a0fb7.tar.gz
cpython-d2fd4cae8e7a2ebd3e18a6640b4558131b9a0fb7.tar.bz2
Add Breakpoint.bpformat(), which returns the info usually printed by bpprint(). Necessary for major refactoring of pdb output handling.
Diffstat (limited to 'Lib/bdb.py')
-rw-r--r--Lib/bdb.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/bdb.py b/Lib/bdb.py
index ffeca72..a38ee2d 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -499,6 +499,9 @@ class Breakpoint:
def bpprint(self, out=None):
if out is None:
out = sys.stdout
+ print(self.bpformat(), file=out)
+
+ def bpformat(self):
if self.temporary:
disp = 'del '
else:
@@ -507,17 +510,19 @@ class Breakpoint:
disp = disp + 'yes '
else:
disp = disp + 'no '
- print('%-4dbreakpoint %s at %s:%d' % (self.number, disp,
- self.file, self.line), file=out)
+ ret = '%-4dbreakpoint %s at %s:%d' % (self.number, disp,
+ self.file, self.line)
if self.cond:
- print('\tstop only if %s' % (self.cond,), file=out)
+ ret += '\n\tstop only if %s' % (self.cond,)
if self.ignore:
- print('\tignore next %d hits' % (self.ignore), file=out)
- if (self.hits):
- if (self.hits > 1): ss = 's'
- else: ss = ''
- print(('\tbreakpoint already hit %d time%s' %
- (self.hits, ss)), file=out)
+ ret += '\n\tignore next %d hits' % (self.ignore,)
+ if self.hits:
+ if self.hits > 1:
+ ss = 's'
+ else:
+ ss = ''
+ ret += '\n\tbreakpoint already hit %d time%s' % (self.hits, ss)
+ return ret
def __str__(self):
return 'breakpoint %s at %s:%s' % (self.number, self.file, self.line)