diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2008-02-23 15:49:35 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2008-02-23 15:49:35 (GMT) |
commit | 322349e31b3c1472543428382b84a32d2fc2dfc7 (patch) | |
tree | e7b385c87e8b707d370da6a0c65053538e7aa3ba /Lib | |
parent | 5972493383434e34a8ed00b3fecbfd7aaa484003 (diff) | |
download | cpython-322349e31b3c1472543428382b84a32d2fc2dfc7.zip cpython-322349e31b3c1472543428382b84a32d2fc2dfc7.tar.gz cpython-322349e31b3c1472543428382b84a32d2fc2dfc7.tar.bz2 |
#1119331: ncurses will just call exit() if the terminal name isn't found.
Call setupterm() first so that we get a Python exception instead of just existing.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/curses/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/curses/__init__.py b/Lib/curses/__init__.py index aba540b..c3f2f25 100644 --- a/Lib/curses/__init__.py +++ b/Lib/curses/__init__.py @@ -14,6 +14,7 @@ __revision__ = "$Id$" from _curses import * from curses.wrapper import wrapper +import os as _os # Some constants, most notably the ACS_* ones, are only added to the C # _curses module's dictionary after initscr() is called. (Some @@ -25,6 +26,9 @@ from curses.wrapper import wrapper def initscr(): import _curses, curses + # we call setupterm() here because it raises an error + # instead of calling exit() in error cases. + setupterm(term=_os.environ.get("TERM", "unknown")) stdscr = _curses.initscr() for key, value in _curses.__dict__.items(): if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'): |