[Python-checkins] CVS: python/dist/src/Lib/curses wrapper.py,1.2,1.3

A.M. Kuchling python-dev@python.org
Mon, 26 Jun 2000 17:50:42 -0700


Update of /cvsroot/python/python/dist/src/Lib/curses
In directory slayer.i.sourceforge.net:/tmp/cvs-serv26153

Modified Files:
	wrapper.py 
Log Message:
Drop back to old version of wrapper(); ESR reports that it broke things,
and I lack the time to track down the cause.


Index: wrapper.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/curses/wrapper.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** wrapper.py	2000/06/10 23:39:05	1.2
--- wrapper.py	2000/06/27 00:50:40	1.3
***************
*** 18,24 ****
--- 18,26 ----
      """
      
+     res = None
      try:
  	# Initialize curses
  	stdscr=curses.initscr()
+         
  	# Turn off echoing of keys, and enter cbreak mode,
  	# where no buffering is performed on keyboard input
***************
*** 30,39 ****
          stdscr.keypad(1)
  
! 	return apply(func, (stdscr,) + rest)
! 
!     finally:
! 	# Restore the terminal to a sane state on the way out.
  	stdscr.keypad(0)
  	curses.echo() ; curses.nocbreak()
  	curses.endwin()
  
--- 32,51 ----
          stdscr.keypad(1)
  
!         res = apply(func, (stdscr,) + rest)
!     except:
! 	# In the event of an error, restore the terminal
! 	# to a sane state.
  	stdscr.keypad(0)
  	curses.echo() ; curses.nocbreak()
  	curses.endwin()
+         
+         # Pass the exception upwards
+         (exc_type, exc_value, exc_traceback) = sys.exc_info()
+         raise exc_type, exc_value, exc_traceback
+     else:
+ 	# Set everything back to normal
+ 	stdscr.keypad(0)
+ 	curses.echo() ; curses.nocbreak()
+ 	curses.endwin()		 # Terminate curses
  
+         return res