From 68fcb958eb0c023cb895217fdf384206b09d12e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Denizhan=20Dak=C4=B1l=C4=B1r?= Date: Mon, 5 Jan 2026 07:39:11 +0300 Subject: [PATCH] gh-143082: Make readline work when sys.stdin is explicitly passed to pdb (#143083) --- Lib/pdb.py | 2 +- .../next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst diff --git a/Lib/pdb.py b/Lib/pdb.py index eee0273fdc46..0464b288ef82 100644 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -364,7 +364,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): 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 is not None and stdin is not sys.stdin: self.use_rawinput = False self.prompt = '(Pdb) ' self.aliases = {} 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 000000000000..0652c4ca9300 --- /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``. -- 2.47.3