From 0529ceca06d7e6a73679d5fe37bc51f28abe6313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denizhan=20Dak=C4=B1l=C4=B1r?= Date: Mon, 22 Dec 2025 23:47:56 +0300 Subject: [PATCH 1/3] Fix readline backend check and stdin isatty condition in cmd and pdb modules --- Lib/cmd.py | 2 +- Lib/pdb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/cmd.py b/Lib/cmd.py index 51495fb32160b0..ee124005e1c51b 100644 --- a/Lib/cmd.py +++ b/Lib/cmd.py @@ -111,7 +111,7 @@ def cmdloop(self, intro=None): import readline self.old_completer = readline.get_completer() readline.set_completer(self.complete) - if readline.backend == "editline": + if getattr(readline, 'backend', None) == "editline": if self.completekey == 'tab': # libedit uses "^I" instead of "tab" command_string = "bind ^I rl_complete" diff --git a/Lib/pdb.py b/Lib/pdb.py index eee0273fdc463f..42a6580e258ef7 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -364,7 +364,7 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None, bdb.Bdb.__init__(self, skip=skip, backend=backend if backend else get_default_backend()) cmd.Cmd.__init__(self, completekey, stdin, stdout) sys.audit("pdb.Pdb") - if stdin: + if stdin and not getattr(stdin, 'isatty', lambda: False)(): self.use_rawinput = False self.prompt = '(Pdb) ' self.aliases = {} From 2cb24f339e592cbe4c3fef9790a83c99974b3704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denizhan=20Dak=C4=B1l=C4=B1r?= Date: Thu, 25 Dec 2025 03:32:55 +0300 Subject: [PATCH 2/3] adress gaogao's comments about different ttys --- Lib/pdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/pdb.py b/Lib/pdb.py index 42a6580e258ef7..0464b288ef825a 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -364,7 +364,7 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None, bdb.Bdb.__init__(self, skip=skip, backend=backend if backend else get_default_backend()) cmd.Cmd.__init__(self, completekey, stdin, stdout) sys.audit("pdb.Pdb") - if stdin and not getattr(stdin, 'isatty', lambda: False)(): + if stdin is not None and stdin is not sys.stdin: self.use_rawinput = False self.prompt = '(Pdb) ' self.aliases = {} From d1d6a78f4f8a454774e3f4566912a64f30767918 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 25 Dec 2025 00:38:21 +0000 Subject: [PATCH 3/3] =?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/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst diff --git a/Misc/NEWS.d/next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst b/Misc/NEWS.d/next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst new file mode 100644 index 00000000000000..0652c4ca930027 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst @@ -0,0 +1 @@ +Fix :mod:`pdb` arrow key history not working when ``stdin`` is ``sys.stdin``.