[Python-checkins] (merge 3.1 -> 3.2): Issue #5622: merge fix from 3.1.

ned.deily python-checkins at python.org
Wed Mar 9 11:50:46 CET 2011


http://hg.python.org/cpython/rev/e6c45cd46cb2
changeset:   68340:e6c45cd46cb2
branch:      3.2
parent:      68336:39469645857a
parent:      68339:6b6b8af33811
user:        Ned Deily <nad at acm.org>
date:        Wed Mar 09 02:42:23 2011 -0800
summary:
  Issue #5622: merge fix from 3.1.

files:
  Misc/NEWS

diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py
--- a/Lib/curses/wrapper.py
+++ b/Lib/curses/wrapper.py
@@ -43,7 +43,8 @@
         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()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -31,6 +31,9 @@
 Library
 -------
 
+- Issue #5622: Fix curses.wrapper to raise correct exception if curses
+  initialization fails.
+
 - Issue #11391: Writing to a mmap object created with
   ``mmap.PROT_READ|mmap.PROT_EXEC`` would segfault instead of raising a
   TypeError.  Patch by Charles-François Natali.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list