New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idle: review 'missing' attributes of pseudofiles #66194
Comments
sys.stdin on 3.4.1 is also 'missing' (among public names) 'line_buffering' (True) and 'mode' ('r'). It seems that these could be trivially added, so the focus of this issue is 'buffer'. The associated 3.4.1 Console interpreter:
>>> import sys; b = sys.stdin.buffer.readline()
a line
>>> b
b'a line\r\n'
3.4.1 Idle:
>>> import sys; b = sys.stdin.buffer.readline()
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import sys; b = sys.stdin.buffer.readline()
AttributeError: 'PseudoInputFile' object has no attribute 'buffer' https://docs.python.org/3/library/sys.html#sys.stdin As far as I could find, the Idle doc does not mention the standard streams, let alone Idle specific limitations. I intentionally wrote the title as a statement of a problematical situation, rather than as a proposed solution, as there are two: change code and change doc. Code: add .buffer as a bytes-oriented Pseudofile. Doc: at least mention that standard streams are replaced by objects that ship text between processes, and use gui for input and display, and the consiquences of this. |
New changeset ac6ade0c5927 by Terry Jan Reedy in branch '2.7': New changeset ca6c9cc77c20 by Terry Jan Reedy in branch '3.4': |
https://docs.python.org/3/library/io.html#io.TextIOBase.buffer The underlying binary buffer (a BufferedIOBase instance) that TextIOBase deals with. This is not part of the TextIOBase API and may not exist in some implementations.""" It is common to replace standard streams with StringIO. |
I believe this issue was derived from another were someone complained about something else being missing. I will just look into the other two and see if they are supposed to be there. |
Related bpo-23220 has draft of part of what pushed. I want to do more on the subject. |
Yet one example of test stream that has no buffer - stdprinter used as sys.stderr on early stage of Python startup. |
I changed title to 'review' (TextIOBase doc and StringIO as a pure text implementation). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: