mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									7b3c8a1422
								
							
						
					
					
						commit
						3577113d83
					
				
					 6 changed files with 63 additions and 4 deletions
				
			
		| 
						 | 
					@ -385,6 +385,7 @@
 | 
				
			||||||
DEPTHCHANGE = 543
 | 
					DEPTHCHANGE = 543
 | 
				
			||||||
WINSHUT = 546
 | 
					WINSHUT = 546
 | 
				
			||||||
DRAWOVERLAY = 547
 | 
					DRAWOVERLAY = 547
 | 
				
			||||||
 | 
					VIDEO = 548
 | 
				
			||||||
MENUBUTTON = RIGHTMOUSE
 | 
					MENUBUTTON = RIGHTMOUSE
 | 
				
			||||||
WINCLOSE = 537
 | 
					WINCLOSE = 537
 | 
				
			||||||
KEYBDFNAMES = 544
 | 
					KEYBDFNAMES = 544
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# XXX To do:
 | 
					# XXX To do:
 | 
				
			||||||
# - don't fall out of bottom frame
 | 
					# - don't fall out of bottom frame
 | 
				
			||||||
# - is the /tmp file hack really needed?
 | 
					 | 
				
			||||||
# - also use it for post-mortem debugging
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import stdwin
 | 
					import stdwin
 | 
				
			||||||
| 
						 | 
					@ -273,6 +271,8 @@ def draw(self, detail):
 | 
				
			||||||
			d.close()
 | 
								d.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Simplified interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def run(statement):
 | 
					def run(statement):
 | 
				
			||||||
	x = Wdb().init()
 | 
						x = Wdb().init()
 | 
				
			||||||
	try: x.run(statement)
 | 
						try: x.run(statement)
 | 
				
			||||||
| 
						 | 
					@ -288,6 +288,21 @@ def runcall(*args):
 | 
				
			||||||
	try: apply(Pdb().init().runcall, args)
 | 
						try: apply(Pdb().init().runcall, args)
 | 
				
			||||||
	finally: x.close()
 | 
						finally: x.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Post-Mortem interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def post_mortem(traceback):
 | 
				
			||||||
 | 
						p = Pdb().init()
 | 
				
			||||||
 | 
						p.reset()
 | 
				
			||||||
 | 
						p.interaction(None, traceback)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def pm():
 | 
				
			||||||
 | 
						import sys
 | 
				
			||||||
 | 
						post_mortem(sys.last_traceback)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Main program for testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TESTCMD = 'import x; x.main()'
 | 
					TESTCMD = 'import x; x.main()'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test():
 | 
					def test():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,15 @@ To use the debugger in its simplest form:
 | 
				
			||||||
The debugger's prompt is '(Pdb) '.  This will stop in the first
 | 
					The debugger's prompt is '(Pdb) '.  This will stop in the first
 | 
				
			||||||
function call in <a statement>.
 | 
					function call in <a statement>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Alternatively, if a statement terminated with an unhandled exception,
 | 
				
			||||||
 | 
					you can use pdb's post-mortem facility to inspect the contents of the
 | 
				
			||||||
 | 
					traceback:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						>>> <a statement>
 | 
				
			||||||
 | 
						<exception traceback>
 | 
				
			||||||
 | 
						>>> import pdb
 | 
				
			||||||
 | 
						>>> pdb.pm()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The commands recognized by the debugger are listed in the next
 | 
					The commands recognized by the debugger are listed in the next
 | 
				
			||||||
section.  Most can be abbreviated as indicated; e.g., h(elp) means
 | 
					section.  Most can be abbreviated as indicated; e.g., h(elp) means
 | 
				
			||||||
that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
 | 
					that 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										18
									
								
								Lib/pdb.py
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								Lib/pdb.py
									
										
									
									
									
								
							| 
						 | 
					@ -248,6 +248,8 @@ def print_stack_entry(self, frame_lineno):
 | 
				
			||||||
		print self.format_stack_entry(frame_lineno)
 | 
							print self.format_stack_entry(frame_lineno)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Simplified interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def run(statement):
 | 
					def run(statement):
 | 
				
			||||||
	Pdb().init().run(statement)
 | 
						Pdb().init().run(statement)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -257,6 +259,22 @@ def runctx(statement, globals, locals):
 | 
				
			||||||
def runcall(*args):
 | 
					def runcall(*args):
 | 
				
			||||||
	apply(Pdb().init().runcall, args)
 | 
						apply(Pdb().init().runcall, args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Post-Mortem interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def post_mortem(t):
 | 
				
			||||||
 | 
						p = Pdb().init()
 | 
				
			||||||
 | 
						p.reset()
 | 
				
			||||||
 | 
						while t.tb_next <> None: t = t.tb_next
 | 
				
			||||||
 | 
						p.interaction(t.tb_frame, t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def pm():
 | 
				
			||||||
 | 
						import sys
 | 
				
			||||||
 | 
						post_mortem(sys.last_traceback)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Main program for testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TESTCMD = 'import x; x.main()'
 | 
					TESTCMD = 'import x; x.main()'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test():
 | 
					def test():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -385,6 +385,7 @@
 | 
				
			||||||
DEPTHCHANGE = 543
 | 
					DEPTHCHANGE = 543
 | 
				
			||||||
WINSHUT = 546
 | 
					WINSHUT = 546
 | 
				
			||||||
DRAWOVERLAY = 547
 | 
					DRAWOVERLAY = 547
 | 
				
			||||||
 | 
					VIDEO = 548
 | 
				
			||||||
MENUBUTTON = RIGHTMOUSE
 | 
					MENUBUTTON = RIGHTMOUSE
 | 
				
			||||||
WINCLOSE = 537
 | 
					WINCLOSE = 537
 | 
				
			||||||
KEYBDFNAMES = 544
 | 
					KEYBDFNAMES = 544
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# XXX To do:
 | 
					# XXX To do:
 | 
				
			||||||
# - don't fall out of bottom frame
 | 
					# - don't fall out of bottom frame
 | 
				
			||||||
# - is the /tmp file hack really needed?
 | 
					 | 
				
			||||||
# - also use it for post-mortem debugging
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import stdwin
 | 
					import stdwin
 | 
				
			||||||
| 
						 | 
					@ -273,6 +271,8 @@ def draw(self, detail):
 | 
				
			||||||
			d.close()
 | 
								d.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Simplified interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def run(statement):
 | 
					def run(statement):
 | 
				
			||||||
	x = Wdb().init()
 | 
						x = Wdb().init()
 | 
				
			||||||
	try: x.run(statement)
 | 
						try: x.run(statement)
 | 
				
			||||||
| 
						 | 
					@ -288,6 +288,21 @@ def runcall(*args):
 | 
				
			||||||
	try: apply(Pdb().init().runcall, args)
 | 
						try: apply(Pdb().init().runcall, args)
 | 
				
			||||||
	finally: x.close()
 | 
						finally: x.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Post-Mortem interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def post_mortem(traceback):
 | 
				
			||||||
 | 
						p = Pdb().init()
 | 
				
			||||||
 | 
						p.reset()
 | 
				
			||||||
 | 
						p.interaction(None, traceback)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def pm():
 | 
				
			||||||
 | 
						import sys
 | 
				
			||||||
 | 
						post_mortem(sys.last_traceback)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Main program for testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TESTCMD = 'import x; x.main()'
 | 
					TESTCMD = 'import x; x.main()'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test():
 | 
					def test():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue