Message304231
| Author |
vstinner |
| Recipients |
berker.peksag, eryksun, gdr@garethrees.org, ncoghlan, serhiy.storchaka, vstinner |
| Date |
2017年10月12日.13:15:16 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1507814116.05.0.213398074469.issue28647@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Serhiy: "(...) I think it is more correct to say that stdin is always unbuffered in Python 3."
I disagree. Technically, sys.stdin.read(1) reads up to 1024 bytes from the file descriptor 0. For me, "unbuffered read" means that read(1) reads a single byte.
Expected behaviour of an fully unbuffered stdin:
assert sys.stdin.read(1) == 'a'
assert os.read(0, 1) == b'b'
The program should not fail with an assertion error nor block if you write 'ab' characters into stdin. |
|