[New-bugs-announce] [issue29396] Re-opening /dev/tty breaks readline

Silvio Ricardo Cordeiro report at bugs.python.org
Tue Jan 31 05:53:07 EST 2017


New submission from Silvio Ricardo Cordeiro:

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

----------
components: Library (Lib)
messages: 286521
nosy: silvioricardoc
priority: normal
severity: normal
status: open
title: Re-opening /dev/tty breaks readline
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29396>
_______________________________________


More information about the New-bugs-announce mailing list