From 0ec5288d09e2ac3652c8a88f644417629ed1e759 Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Tue, 2 Sep 2003 11:44:44 +0000 Subject: [Patch #759208] Fix has_key emulation to not raise KeyError --- Lib/curses/has_key.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/curses/has_key.py b/Lib/curses/has_key.py index 728c614..cac0cd1 100644 --- a/Lib/curses/has_key.py +++ b/Lib/curses/has_key.py @@ -163,7 +163,9 @@ def has_key(ch): if type(ch) == type( '' ): ch = ord(ch) # Figure out the correct capability name for the keycode. - capability_name = _capability_names[ch] + capability_name = _capability_names.get(ch) + if capability_name is None: + return 0 #Check the current terminal description for that capability; #if present, return true, else return false. -- cgit v0.12