Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3577113

Browse files
committed
Added post_mortem() and pm() interfaces to pdb and wdb.
Added colorsys.py (color system conversions). SV.py: new version for new svideo.h (Sjoerd). DEVICE.py: added VIDEO event type.
1 parent 7b3c8a1 commit 3577113

6 files changed

Lines changed: 63 additions & 4 deletions

File tree

Lib/irix5/DEVICE.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
DEPTHCHANGE = 543
386386
WINSHUT = 546
387387
DRAWOVERLAY = 547
388+
VIDEO = 548
388389
MENUBUTTON = RIGHTMOUSE
389390
WINCLOSE = 537
390391
KEYBDFNAMES = 544

Lib/lib-stdwin/wdb.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
# XXX To do:
44
# - don't fall out of bottom frame
5-
# - is the /tmp file hack really needed?
6-
# - also use it for post-mortem debugging
75

86

97
import stdwin
@@ -273,6 +271,8 @@ def draw(self, detail):
273271
d.close()
274272

275273

274+
# Simplified interface
275+
276276
def run(statement):
277277
x = Wdb().init()
278278
try: x.run(statement)
@@ -288,6 +288,21 @@ def runcall(*args):
288288
try: apply(Pdb().init().runcall, args)
289289
finally: x.close()
290290

291+
292+
# Post-Mortem interface
293+
294+
def post_mortem(traceback):
295+
p = Pdb().init()
296+
p.reset()
297+
p.interaction(None, traceback)
298+
299+
def pm():
300+
import sys
301+
post_mortem(sys.last_traceback)
302+
303+
304+
# Main program for testing
305+
291306
TESTCMD = 'import x; x.main()'
292307

293308
def test():

Lib/pdb.doc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ To use the debugger in its simplest form:
99
The debugger's prompt is '(Pdb) '. This will stop in the first
1010
function call in <a statement>.
1111

12+
Alternatively, if a statement terminated with an unhandled exception,
13+
you can use pdb's post-mortem facility to inspect the contents of the
14+
traceback:
15+
16+
>>> <a statement>
17+
<exception traceback>
18+
>>> import pdb
19+
>>> pdb.pm()
20+
1221
The commands recognized by the debugger are listed in the next
1322
section. Most can be abbreviated as indicated; e.g., h(elp) means
1423
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',

Lib/pdb.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ def print_stack_entry(self, frame_lineno):
248248
print self.format_stack_entry(frame_lineno)
249249

250250

251+
# Simplified interface
252+
251253
def run(statement):
252254
Pdb().init().run(statement)
253255

@@ -257,6 +259,22 @@ def runctx(statement, globals, locals):
257259
def runcall(*args):
258260
apply(Pdb().init().runcall, args)
259261

262+
263+
# Post-Mortem interface
264+
265+
def post_mortem(t):
266+
p = Pdb().init()
267+
p.reset()
268+
while t.tb_next <> None: t = t.tb_next
269+
p.interaction(t.tb_frame, t)
270+
271+
def pm():
272+
import sys
273+
post_mortem(sys.last_traceback)
274+
275+
276+
# Main program for testing
277+
260278
TESTCMD = 'import x; x.main()'
261279

262280
def test():

Lib/plat-irix5/DEVICE.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
DEPTHCHANGE = 543
386386
WINSHUT = 546
387387
DRAWOVERLAY = 547
388+
VIDEO = 548
388389
MENUBUTTON = RIGHTMOUSE
389390
WINCLOSE = 537
390391
KEYBDFNAMES = 544

Lib/stdwin/wdb.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
# XXX To do:
44
# - don't fall out of bottom frame
5-
# - is the /tmp file hack really needed?
6-
# - also use it for post-mortem debugging
75

86

97
import stdwin
@@ -273,6 +271,8 @@ def draw(self, detail):
273271
d.close()
274272

275273

274+
# Simplified interface
275+
276276
def run(statement):
277277
x = Wdb().init()
278278
try: x.run(statement)
@@ -288,6 +288,21 @@ def runcall(*args):
288288
try: apply(Pdb().init().runcall, args)
289289
finally: x.close()
290290

291+
292+
# Post-Mortem interface
293+
294+
def post_mortem(traceback):
295+
p = Pdb().init()
296+
p.reset()
297+
p.interaction(None, traceback)
298+
299+
def pm():
300+
import sys
301+
post_mortem(sys.last_traceback)
302+
303+
304+
# Main program for testing
305+
291306
TESTCMD = 'import x; x.main()'
292307

293308
def test():

0 commit comments

Comments
 (0)