https://github.com/python/cpython/commit/f6b5eed47de2de13da94332231eb9c3f4769c78d
commit: f6b5eed47de2de13da94332231eb9c3f4769c78d
branch: main
author: Jonathan Dung <[email protected]>
committer: vstinner <[email protected]>
date: 2026-03-21T14:06:07+01:00
summary:
gh-146153: Use `frozendict` in pure python fallback for `curses.has_key`
(#146154)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
files:
M Lib/curses/has_key.py
diff --git a/Lib/curses/has_key.py b/Lib/curses/has_key.py
index 4e37b480f13353..3471b28cbbe017 100644
--- a/Lib/curses/has_key.py
+++ b/Lib/curses/has_key.py
@@ -7,7 +7,7 @@
# Table mapping curses keys to the terminfo capability name
-_capability_names = {
+_capability_names = frozendict({
_curses.KEY_A1: 'ka1',
_curses.KEY_A3: 'ka3',
_curses.KEY_B2: 'kb2',
@@ -157,7 +157,7 @@
_curses.KEY_SUSPEND: 'kspd',
_curses.KEY_UNDO: 'kund',
_curses.KEY_UP: 'kcuu1'
- }
+ })
def has_key(ch):
if isinstance(ch, str):
@@ -170,7 +170,7 @@ def has_key(ch):
#Check the current terminal description for that capability;
#if present, return true, else return false.
- if _curses.tigetstr( capability_name ):
+ if _curses.tigetstr(capability_name):
return True
else:
return False
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]