[New-bugs-announce] [issue11716] mixing calls to io.TextIOWrapper.write and io.BufferedWriter.write produces undefined results

Sean Sherrard report at bugs.python.org
Wed Mar 30 01:03:17 CEST 2011


New submission from Sean Sherrard <mssherrard at gmail.com>:

Maybe this is by design, but it certainly took me by surprise.

Steps to reproduce:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import io
>>> raw = io.BytesIO()
>>> buf = io.BufferedWriter(raw)
>>> txt = io.TextIOWrapper(buf)
>>> txt.write('one.')
4
>>> txt.buffer.write(b'two.')
4
>>> txt.flush()
>>> raw.getvalue()
b'two.one.'

Same results in 2.7

----------
components: Library (Lib)
messages: 132553
nosy: Sean.Sherrard
priority: normal
severity: normal
status: open
title: mixing calls to io.TextIOWrapper.write and io.BufferedWriter.write produces undefined results
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

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


More information about the New-bugs-announce mailing list