[New-bugs-announce] [issue5568] self.writer.closed() extraneous parens in BufferedRWPair of io module
Jim Olson
report at bugs.python.org
Thu Mar 26 18:35:12 CET 2009
New submission from Jim Olson <jimo555 at gmail.com>:
import io
# Corrected a typo in Python261/Lib/io.py at line 1167
# return self.writer.closed() ==> return self.writer.closed
# in
# @property
# def closed(self):
# return self.writer.closed
#also: shouldn't ascii strings still work in Python 2.6.1 for
#StringIO and TextIO? As shown below, writes only work with unicode strings.
#Python 3 changes default encoding to utf-8 but 2.6.1 is still ascii:
#>>> import sys
#>>> sys.getdefaultencoding()
#'ascii'
# Sorry if I am wrong about this.
ba = buffer('circle')
s = io.StringIO(ba)
print s.getvalue()
#ascii string doesn't work in Python 2.6.1 -- print s.write('square')
print s.write(u'square')
print s.read()
print s.getvalue(), '\n\n'
f = io.FileIO('ioex.txt', 'a+')
r = io.BufferedReader(f)
w = io.BufferedWriter(f)
p = io.BufferedRWPair(r, w)
t = io.TextIOWrapper(p, line_buffering=True)
print t.read(3)
print t.read()
print f.write('julius ceaser\n')
lines = ['william', 'shakespeare', '\n']
f.writelines(' '.join(lines))
#ascii string doesn't work in Python 2.6.1 -- print t.write('marc
anthony\n')
print t.write(u'marc anthony\n')
----------
files: ioex.py
messages: 84190
nosy: jimo555
severity: normal
status: open
title: self.writer.closed() extraneous parens in BufferedRWPair of io module
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file13420/ioex.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5568>
_______________________________________
More information about the New-bugs-announce
mailing list