From 540afcde594397208cda2c53ec3a3edd25ae2fcd Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 15:35:30 +0800 Subject: [PATCH 1/9] Use frozenmap in curses/has_key.py --- Lib/curses/has_key.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/curses/has_key.py b/Lib/curses/has_key.py index 4e37b480f13353..a021ff87212b15 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 = frozenmap({ _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): From c51e72c4d983de238b919674791783d58e1ef35a Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 15:50:37 +0800 Subject: [PATCH 2/9] Remove whitespace surrounding parentheses --- Lib/curses/has_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/curses/has_key.py b/Lib/curses/has_key.py index a021ff87212b15..1f9154606e4014 100644 --- a/Lib/curses/has_key.py +++ b/Lib/curses/has_key.py @@ -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 From 805dcb25c3b60654a5b97bd39a042a2d20e00ee8 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 08:48:22 +0000 Subject: [PATCH 3/9] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst diff --git a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst new file mode 100644 index 00000000000000..7b7eaa32eb61c2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst @@ -0,0 +1 @@ +Changed the `_capability_names` dictionary in Lib/curses/has_key.py to a `frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. From 6f25f9359628c04e18f92896d6f35dc5fbc78b55 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 16:52:55 +0800 Subject: [PATCH 4/9] Edit news --- .../next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst index 7b7eaa32eb61c2..93da8844049e93 100644 --- a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst +++ b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst @@ -1 +1 @@ -Changed the `_capability_names` dictionary in Lib/curses/has_key.py to a `frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. +Changed the _capability_names dictionary in :mod:`curses.has_key` to a `frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. From 4891f62536ec7996ee71fa2fa420f218d657bb80 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 16:56:25 +0800 Subject: [PATCH 5/9] Update 2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst --- .../next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst index 93da8844049e93..c06993791ed61e 100644 --- a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst +++ b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst @@ -1 +1 @@ -Changed the _capability_names dictionary in :mod:`curses.has_key` to a `frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. +Changed the :var:`_capability_names` dictionary in :mod:`curses.has_key` to a :class:`frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. From 256374f8897f0370f16a795b2c290a8e97a3508c Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 17:00:52 +0800 Subject: [PATCH 6/9] Fix linter error --- .../next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst index c06993791ed61e..a3259321381281 100644 --- a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst +++ b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst @@ -1 +1 @@ -Changed the :var:`_capability_names` dictionary in :mod:`curses.has_key` to a :class:`frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. +Changed the :data:`_capability_names` dictionary in :mod:`curses.has_key` to a :class:`frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. From c34da916ae2dc1d26bae13ce4572f283991a9a24 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 17:09:43 +0800 Subject: [PATCH 7/9] It's called frozendict not frozenmap --- Lib/curses/has_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/curses/has_key.py b/Lib/curses/has_key.py index 1f9154606e4014..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 = frozenmap({ +_capability_names = frozendict({ _curses.KEY_A1: 'ka1', _curses.KEY_A3: 'ka3', _curses.KEY_B2: 'kb2', From c2aebbb69f8a2e5ba749dbbb51744688ea3e9953 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 19:01:00 +0800 Subject: [PATCH 8/9] Update 2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst --- .../next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst index a3259321381281..980fb424343e48 100644 --- a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst +++ b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst @@ -1 +1 @@ -Changed the :data:`_capability_names` dictionary in :mod:`curses.has_key` to a :class:`frozenmap`, since it is private and requires no modifications. Contributed by Jonathan Dung. +Changed the ``_capability_names`` dictionary in :mod:`curses.has_key` to a :class:`frozendict`, since it is private and requires no modifications. Contributed by Jonathan Dung. From 52652d69ec59bd73ca783eb9a39f3ff3be933872 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Thu, 19 Mar 2026 22:25:14 +0800 Subject: [PATCH 9/9] Delete Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst --- .../next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst diff --git a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst b/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst deleted file mode 100644 index 980fb424343e48..00000000000000 --- a/Misc/NEWS.d/next/Library/2026-03-19-08-48-21.gh-issue-146153.UTK9Mb.rst +++ /dev/null @@ -1 +0,0 @@ -Changed the ``_capability_names`` dictionary in :mod:`curses.has_key` to a :class:`frozendict`, since it is private and requires no modifications. Contributed by Jonathan Dung.