mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
[Patch #759208] Fix has_key emulation to not raise KeyError
This commit is contained in:
parent
f70e076042
commit
0ec5288d09
1 changed files with 3 additions and 1 deletions
|
@ -163,7 +163,9 @@ def has_key(ch):
|
||||||
if type(ch) == type( '' ): ch = ord(ch)
|
if type(ch) == type( '' ): ch = ord(ch)
|
||||||
|
|
||||||
# Figure out the correct capability name for the keycode.
|
# 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;
|
#Check the current terminal description for that capability;
|
||||||
#if present, return true, else return false.
|
#if present, return true, else return false.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue