Title: Make it easy to create a new TextIOWrapper based on an existing
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ncoghlan, pitrou
Priority: normal Keywords:

Created on 2012-02-14 23:49 by ncoghlan, last changed 2013-01-27 01:36 by ezio.melotti.

Messages (2)
msg153376 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2012-02-14 23:49
io.TextIOWrapper acquired a new "write_through" argument for 3.3, but that is not exposed as a documented attribute.

This is needed so that a text wrapper can be replaced with an equivalent that only alters selected settings (such as the Unicode error handler).
msg153377 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2012-02-14 23:59
Updating issue title, since I realised this doesn't work in 3.2 either (the "newline" argument also isn't available for introspection - "newlines" is not the same thing)

Possible API signature:

    _missing = object()
    def rewrap(self, encoding=_missing, errors=_missing, newline=_missing, line_buffering=_missing, write_through=_missing):

That is, accept the same arguments as __init__ (excluding the buffer argument), with any arguments not explicitly supplied replaced with the values from the current instance.
Date User Action Args
2013-01-27 01:36:31ezio.melottisetnosy: + pitrou
stage: needs patch
type: enhancement

versions: + Python 3.4, - Python 3.3
2012-02-14 23:59:33ncoghlansetmessages: + msg153377
title: io.TextIOWrapper should expose a documented write_through attribute -> Make it easy to create a new TextIOWrapper based on an existing
2012-02-14 23:49:33ncoghlancreate