[pypy-commit] pypy default: Fix for 612f7784a228.

arigo noreply at buildbot.pypy.org
Fri Nov 18 16:49:13 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49530:5269f0ee1ed2
Date: 2011-11-18 16:48 +0100
http://bitbucket.org/pypy/pypy/changeset/5269f0ee1ed2/

Log:	Fix for 612f7784a228.

diff --git a/pypy/rpython/lltypesystem/rbuilder.py b/pypy/rpython/lltypesystem/rbuilder.py
--- a/pypy/rpython/lltypesystem/rbuilder.py
+++ b/pypy/rpython/lltypesystem/rbuilder.py
@@ -123,9 +123,10 @@
     def ll_build(ll_builder):
         final_size = ll_builder.used
         assert final_size >= 0
-        if final_size == ll_builder.allocated:
-            return ll_builder.buf
-        return rgc.ll_shrink_array(ll_builder.buf, final_size)
+        if final_size < ll_builder.allocated:
+            ll_builder.allocated = final_size
+            ll_builder.buf = rgc.ll_shrink_array(ll_builder.buf, final_size)
+        return ll_builder.buf
 
     @classmethod
     def ll_is_true(cls, ll_builder):
diff --git a/pypy/translator/c/test/test_newgc.py b/pypy/translator/c/test/test_newgc.py
--- a/pypy/translator/c/test/test_newgc.py
+++ b/pypy/translator/c/test/test_newgc.py
@@ -1324,15 +1324,15 @@
             s = StringBuilder(4)
             got = []
             for i in range(50):
-                s.append(chr(i))
+                s.append(chr(33+i))
                 got.append(s.build())
                 gc.collect()
-            return '/'.join(got)
+            return ' '.join(got)
         return fn
 
     def test_string_builder_multiple_builds(self):
         res = self.run('string_builder_multiple_builds')
-        assert res == '/'.join([''.join(map(chr, range(length)))
+        assert res == ' '.join([''.join(map(chr, range(33, 33+length)))
                                 for length in range(1, 51)])
 
     def define_nursery_hash_base(cls):


More information about the pypy-commit mailing list