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 piwi
Recipients agthorr, loewis, mwh, piwi
Date 2021-05-01.20:08:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619899739.01.0.403683286222.issue512981@roundup.psfhosted.org>
In-reply-to
Content
I suggest to reopen this issue as there was a regression with python3.

import sys
sys.stdin = open("/dev/tty", "r")
import readline
print(input())

Write some text and press left.
Expected: the cursor goes left.
Actual: prints '^[[D' as is readline had not been imported.

bltinmodule.c checks that the current sys.stdin filno matches the C stdin fileno. When they are different, it falls back to the default input implementation.

https://github.com/python/cpython/blob/1e7b858575d0ad782939f86aae4a2fa1c29e9f14/Python/bltinmodule.c#L2097

I noticed that PyFile_AsFile no longer exists. Would calling `fdopen` be acceptable?
History
Date User Action Args
2021-05-01 20:08:59piwisetrecipients: + piwi, mwh, loewis, agthorr
2021-05-01 20:08:59piwisetmessageid: <1619899739.01.0.403683286222.issue512981@roundup.psfhosted.org>
2021-05-01 20:08:58piwilinkissue512981 messages
2021-05-01 20:08:58piwicreate