https://github.com/python/cpython/commit/68fcb958eb0c023cb895217fdf384206b09d12e8
commit: 68fcb958eb0c023cb895217fdf384206b09d12e8
branch: main
author: Denizhan Dakılır <[email protected]>
committer: gaogaotiantian <[email protected]>
date: 2026-01-04T20:39:11-08:00
summary:

gh-143082: Make readline work when sys.stdin is explicitly passed to pdb 
(#143083)

files:
A Misc/NEWS.d/next/Windows/2025-12-25-00-38-20.gh-issue-143082.CYUeux.rst
M Lib/pdb.py

diff --git a/Lib/pdb.py b/Lib/pdb.py
index eee0273fdc463f..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:
+        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 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``.

_______________________________________________
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]

Reply via email to