This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author silvioricardoc
Recipients silvioricardoc
Date 2017-01-31.10:53:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485859987.68.0.026952717617.issue29396@psf.upfronthosting.co.za>
In-reply-to
Content
The following code works on python2 (tested with 2.7.6), but breaks readline for python3 (tested with 3.4.3):

>>> import sys, readline
>>> sys.stdin = open('/dev/tty', 'r')
>>> input("> ")  # press "7<Enter>"
>>> input("> ")  # press "up" key

Re-opening /dev/tty as stdin is a very useful technique. For example, one could debug a script that takes a file as stdin by re-opening the stdin as /dev/tty and using pdb.set_trace().

See bug report for python2 in 2002 here: https://bugs.python.org/issue512981
History
Date User Action Args
2017-01-31 10:53:07silvioricardocsetrecipients: + silvioricardoc
2017-01-31 10:53:07silvioricardocsetmessageid: <1485859987.68.0.026952717617.issue29396@psf.upfronthosting.co.za>
2017-01-31 10:53:07silvioricardoclinkissue29396 messages
2017-01-31 10:53:07silvioricardoccreate