summaryrefslogtreecommitdiffstats
path: root/Lib/curses
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2011-03-09 10:36:51 (GMT)
committerNed Deily <nad@acm.org>2011-03-09 10:36:51 (GMT)
commitd2853180dfd905d07aa07d6f95cc4736d5363f22 (patch)
tree434c1387384304e6df6ff38780e8c830ffcf9650 /Lib/curses
parentc8ab6eeb01ef01d8a630cbf177b06cece326be54 (diff)
downloadcpython-d2853180dfd905d07aa07d6f95cc4736d5363f22.zip
cpython-d2853180dfd905d07aa07d6f95cc4736d5363f22.tar.gz
cpython-d2853180dfd905d07aa07d6f95cc4736d5363f22.tar.bz2
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 3cdaa82..5183ce7 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()