[pypy-svn] r17092 - pypy/dist/pypy/rpython

arigo at codespeak.net arigo at codespeak.net
Tue Aug 30 18:35:42 CEST 2005


Author: arigo
Date: Tue Aug 30 18:35:39 2005
New Revision: 17092

Modified:
   pypy/dist/pypy/rpython/rlist.py
   pypy/dist/pypy/rpython/rstr.py
Log:
A bug left over from the addition of the 'length' field in rlists, caused by
code that allocated the GcStructs of a list by hand in rstr.py.


Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Tue Aug 30 18:35:39 2005
@@ -18,6 +18,7 @@
 #  Concrete implementation of RPython lists:
 #
 #    struct list {
+#        int length;
 #        items_array *items;
 #    }
 #

Modified: pypy/dist/pypy/rpython/rstr.py
==============================================================================
--- pypy/dist/pypy/rpython/rstr.py	(original)
+++ pypy/dist/pypy/rpython/rstr.py	Tue Aug 30 18:35:39 2005
@@ -886,6 +886,7 @@
     return newstr
 
 def ll_split_chr(LISTPTR, s, c):
+    from pypy.rpython.rlist import ll_newlist
     chars = s.chars
     strlen = len(chars)
     count = 1
@@ -894,8 +895,8 @@
         if chars[i] == c:
             count += 1
         i += 1
-    res = malloc(LISTPTR.TO)
-    items = res.items = malloc(LISTPTR.TO.items.TO, count)
+    res = ll_newlist(LISTPTR, count)
+    items = res.items
 
     i = 0
     j = 0



More information about the Pypy-commit mailing list