[New-bugs-announce] [issue21995] Idle: pseudofiles have no buffer attribute.

Terry J. Reedy report at bugs.python.org
Thu Jul 17 00:47:30 CEST 2014

New submission from Terry J. Reedy:

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 
.detach method is a no-op, (It is also a bit dangerous for interactive operation.)

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'

presents the idiom. It also warns (too narrowly -- 'if you are writing a library ...') that it might not.

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.

assignee: docs at python
components: Documentation, IDLE
messages: 223292
nosy: docs at python, terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: Idle: pseudofiles have no buffer attribute.
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list