test_doctest fails since r59984.
Not sure if these are the correct values, but save_stdout has to be set before its usage...
diff --git a/Lib/pdb.py b/Lib/pdb.py
index e2ace87..8da23d8 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -199,6 +199,8 @@
         globals = self.curframe.f_globals
         try:
             code = compile(line + '\n', '<stdin>', 'single')
+            save_stdout = sys.stdout
+            save_stdin = sys.stdin
             try:
                 sys.stdin = self.stdin
                 sys.stdout = self.stdout