summaryrefslogtreecommitdiff
path: root/Lib/curses
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2011-03-09 02:36:51 -0800
committerNed Deily <nad@acm.org>2011-03-09 02:36:51 -0800
commit7dd79ca53108d4921a0e33e3338fb2fb000e45a2 (patch)
tree144ffd6dc76951cad11c2244fbc8954c90a9027e /Lib/curses
parent75964020ca2e3ab0fec80df923cf30cc0c12670d (diff)
downloadcpython-7dd79ca53108d4921a0e33e3338fb2fb000e45a2.tar.gz
Issue #5622: Fix curses.wrapper to raise correct exception if curses
initialization fails.
Diffstat (limited to 'Lib/curses')
-rw-r--r--Lib/curses/wrapper.py9
1 files changed, 5 insertions, 4 deletions
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()