Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ 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 stdout:
self.use_rawinput = 0
if stdin:
self.use_rawinput = False
self.prompt = '(Pdb) '
self.aliases = {}
self.displaying = {}
Expand Down
13 changes: 13 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4710,6 +4710,19 @@ def test_readline_not_imported(self):
self.assertNotIn("readline imported", stdout)
self.assertEqual(stderr, "")

def test_alternate_stdin(self):
script = textwrap.dedent("""
import pdb
import io

input_data = io.StringIO("p 40 + 2\\nc\\n")
pdb.Pdb(stdin=input_data).set_trace()
""")
commands = ""
stdout, stderr = self._run_script(script, commands)
self.assertIn("42", stdout)
self.assertEqual(stderr, "")


@support.force_colorized_test_class
class PdbTestColorize(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check ``stdin`` instead of ``stdout`` for ``use_rawinput`` in :mod:`pdb`.
Loading