Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ec5288

Browse files
committed
[Patch #759208] Fix has_key emulation to not raise KeyError
1 parent f70e076 commit 0ec5288

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/curses/has_key.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def has_key(ch):
163163
if type(ch) == type( '' ): ch = ord(ch)
164164

165165
# Figure out the correct capability name for the keycode.
166-
capability_name = _capability_names[ch]
166+
capability_name = _capability_names.get(ch)
167+
if capability_name is None:
168+
return 0
167169

168170
#Check the current terminal description for that capability;
169171
#if present, return true, else return false.

0 commit comments

Comments
 (0)