[New-bugs-announce] [issue21364] Documentation Recommends Broken Pattern

Armin Ronacher report at bugs.python.org
Sun Apr 27 17:03:53 CEST 2014


New submission from Armin Ronacher:

The documentation recommends replacing sys.stdin with a binary stream currently: https://docs.python.org/3/library/sys.html#sys.stdin

This sounds like a bad idea because it will break pretty much everything in Python in the process.

As example:

>>> import sys
>>> sys.stdin = sys.stdin.detach()
>>> input('Test: ')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: '_io.BufferedReader' object has no attribute 'errors'

>>> sys.stdout = sys.stdout.detach()
>>> print('Hello World!')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface

----------
messages: 217270
nosy: aronacher
priority: normal
severity: normal
status: open
title: Documentation Recommends Broken Pattern

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


More information about the New-bugs-announce mailing list