[pypy-commit] pypy default: Test for crashes when we call StringBuilder.build() several times over a growing
arigo
noreply at buildbot.pypy.org
Fri Nov 18 16:49:12 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r49529:612f7784a228
Date: 2011-11-18 16:43 +0100
http://bitbucket.org/pypy/pypy/changeset/612f7784a228/
Log: Test for crashes when we call StringBuilder.build() several times
over a growing builder, like W_StringBufferObject does.
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
@@ -1318,6 +1318,23 @@
res = self.run('string_builder_over_allocation')
assert res[1000] == 'y'
+ def definestr_string_builder_multiple_builds(cls):
+ import gc
+ def fn(_):
+ s = StringBuilder(4)
+ got = []
+ for i in range(50):
+ s.append(chr(i))
+ got.append(s.build())
+ gc.collect()
+ 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)))
+ for length in range(1, 51)])
+
def define_nursery_hash_base(cls):
from pypy.rlib.objectmodel import compute_identity_hash
class A:
More information about the pypy-commit
mailing list