]> granicus.if.org Git - python/commitdiff
[Patch #759208] Fix has_key emulation to not raise KeyError
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 2 Sep 2003 11:44:44 +0000 (11:44 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 2 Sep 2003 11:44:44 +0000 (11:44 +0000)
Lib/curses/has_key.py

index 728c614f201cd00060d72f6685800a5d7bcfa7d7..cac0cd11c15c4bbcba55911cc687ff2b3de36da4 100644 (file)
@@ -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.