[New-bugs-announce] [issue15216] Support setting the encoding on a text stream after creation

Nick Coghlan report at bugs.python.org
Thu Jun 28 12:49:18 CEST 2012


New submission from Nick Coghlan <ncoghlan at gmail.com>:

As discussed on python-ideas, swapping out the sys.std* streams can be fraught with peril. This can make writing code that wants to support an "--encoding" option for pipeline processing difficult.

The proposal [1] is that TextIOWrapper support a set_encoding() method that is only supported between creation of the stream and the first read or write operation. Once the stream is "dirty", you can no longer change the encoding - you must replace the stream (e.g. by passing stream.fileNo() to open())

[1] http://mail.python.org/pipermail/python-ideas/2012-June/015535.html

----------
messages: 164239
nosy: ncoghlan
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Support setting the encoding on a text stream after creation
type: enhancement
versions: Python 3.4

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


More information about the New-bugs-announce mailing list