From 7dd79ca53108d4921a0e33e3338fb2fb000e45a2 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Wed, 9 Mar 2011 02:36:51 -0800 Subject: Issue #5622: Fix curses.wrapper to raise correct exception if curses initialization fails. --- Lib/curses/wrapper.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Lib/curses') diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py index 3cdaa82d0a..5183ce741f 100644 --- a/Lib/curses/wrapper.py +++ b/Lib/curses/wrapper.py @@ -43,7 +43,8 @@ def wrapper(func, *args, **kwds): return func(stdscr, *args, **kwds) finally: # Set everything back to normal - stdscr.keypad(0) - curses.echo() - curses.nocbreak() - curses.endwin() + if 'stdscr' in locals(): + stdscr.keypad(0) + curses.echo() + curses.nocbreak() + curses.endwin() -- cgit v1.2.1