summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2003-09-02 11:44:44 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2003-09-02 11:44:44 (GMT)
commit0ec5288d09e2ac3652c8a88f644417629ed1e759 (patch)
treefab6259958c2e70ef91d80f56ea95aa2725c56ab
parentf70e0760420314fec01c6001dac169c836aeca3f (diff)
downloadcpython-0ec5288d09e2ac3652c8a88f644417629ed1e759.zip
cpython-0ec5288d09e2ac3652c8a88f644417629ed1e759.tar.gz
cpython-0ec5288d09e2ac3652c8a88f644417629ed1e759.tar.bz2
[Patch #759208] Fix has_key emulation to not raise KeyError
-rw-r--r--Lib/curses/has_key.py4
1 files changed, 3 insertions, 1 deletions
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.