I just don't buy this. Look at that code. Look at the definition of finally. That code simply screams for the use of finally. Eric: just what happens? What is "broke things"? Do you have a reproducible test case that I can use? In good conscience, I have to disagree with reverting this stuff. If we're seeking to make the code the best possible, then this is a backward step. Besides its redundancy, it also places the traceback into a local variable and then raises an exception -- a perfect recipe for creating a ref loop. Cheers, -g On Mon, Jun 26, 2000 at 05:50:42PM -0700, A.M. Kuchling wrote: > 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 > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://www.python.org/mailman/listinfo/python-checkins -- Greg Stein, http://www.lyra.org/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4