[pypy-commit] pypy default: Use StringBuilder here too.

arigo noreply at buildbot.pypy.org
Sun Oct 7 17:17:48 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r57821:95dbd25adece
Date: 2012-10-07 17:16 +0200
http://bitbucket.org/pypy/pypy/changeset/95dbd25adece/

Log:	Use StringBuilder here too.

diff --git a/pypy/module/_file/interp_file.py b/pypy/module/_file/interp_file.py
--- a/pypy/module/_file/interp_file.py
+++ b/pypy/module/_file/interp_file.py
@@ -185,7 +185,7 @@
             return stream.readline()
         else:
             # very inefficient unless there is a peek()
-            result = []
+            result = StringBuilder()
             while size > 0:
                 # "peeks" on the underlying stream to see how many chars
                 # we can safely read without reading past an end-of-line
@@ -200,7 +200,7 @@
                 if c.endswith('\n'):
                     break
                 size -= len(c)
-            return ''.join(result)
+            return result.build()
 
     @unwrap_spec(size=int)
     def direct_readlines(self, size=0):


More information about the pypy-commit mailing list