[pypy-svn] r57135 - in pypy/dist/pypy/rlib: . test
arigo at codespeak.net
arigo at codespeak.net
Sat Aug 9 16:11:38 CEST 2008
Author: arigo
Date: Sat Aug 9 16:11:38 2008
New Revision: 57135
Modified:
pypy/dist/pypy/rlib/rStringIO.py
pypy/dist/pypy/rlib/test/test_rStringIO.py
Log:
Test and fix (accidentally checked in a branch, merging now).
Modified: pypy/dist/pypy/rlib/rStringIO.py
==============================================================================
--- pypy/dist/pypy/rlib/rStringIO.py (original)
+++ pypy/dist/pypy/rlib/rStringIO.py Sat Aug 9 16:11:38 2008
@@ -45,6 +45,8 @@
return ''.join(self.bigbuffer)
if self.numstrings > 1:
result = self.strings[0] = ''.join(self.strings)
+ for i in range(1, self.numstrings):
+ self.strings[i] = ''
self.numstrings = 1
self.numbigstrings = 1
else:
Modified: pypy/dist/pypy/rlib/test/test_rStringIO.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rStringIO.py (original)
+++ pypy/dist/pypy/rlib/test/test_rStringIO.py Sat Aug 9 16:11:38 2008
@@ -95,6 +95,15 @@
assert f.getvalue() == '\x00' * 3
assert f.tell() == 3
+def test_bug():
+ f = RStringIO()
+ f.write('0')
+ f.write('1')
+ f.write('2')
+ assert f.getvalue() == '012'
+ f.write('3')
+ assert f.getvalue() == '0123'
+
def test_stress():
import cStringIO, random
f = RStringIO()
More information about the Pypy-commit
mailing list