[issue5727] doctest pdb readline broken

Sriram report at bugs.python.org
Tue Apr 27 19:52:36 CEST 2010

Sriram <sriramrathinavelu at yahoo.com> added the comment:


I believe this behaviour can be tested if we can prove that Cmd's cmdloop uses raw_input to get the data as against self.stdin.readline().

To test it, ideally I would have liked to override sys.stdin with a fake input stream and pass the list of args (like it's done in test_doctest.py). I can then pass the character codes for Up and Down Arrows in our fake stream and check if the raw_input can use readline and move through the fake input stream but that won't be possible because the C implementation of raw_input uses the readline functionality if only both stdin and stdout are from a terminal.

So alternatively, if we can just ensure that doctest's pdb (_OutputREdirectingPdb) has use_rawinput as 1, we can be assured that readline will be used.

I have attached the svn diff with trunk. Please review and comment


Added file: http://bugs.python.org/file17109/pdbreadline.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list