[pypy-svn] pypy default: Fix the translation failure by not mixing None and SomeChar

fijal commits-noreply at bitbucket.org
Tue Jan 18 18:43:35 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r40891:6b6ae541b02a
Date: 2011-01-18 19:42 +0200
http://bitbucket.org/pypy/pypy/changeset/6b6ae541b02a/

Log:	Fix the translation failure by not mixing None and SomeChar

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -96,7 +96,8 @@
 
     sequence2 = space.listview(w_sequence)
     items = w_list.wrappeditems
-    _setitem_slice_helper(space, items, start, 1, stop-start, sequence2)
+    _setitem_slice_helper(space, items, start, 1, stop-start, sequence2,
+                          empty_elem=None)
 
 def delslice__List_ANY_ANY(space, w_list, w_start, w_stop):
     length = len(w_list.wrappeditems)
@@ -265,9 +266,11 @@
 
     sequence2 = space.listview(w_iterable)
     items = w_list.wrappeditems
-    _setitem_slice_helper(space, items, start, step, slicelength, sequence2)
+    _setitem_slice_helper(space, items, start, step, slicelength, sequence2,
+                          empty_elem=None)
 
-def _setitem_slice_helper(space, items, start, step, slicelength, sequence2):
+def _setitem_slice_helper(space, items, start, step, slicelength, sequence2,
+                          empty_elem):
     assert slicelength >= 0
     oldsize = len(items)
     len2 = len(sequence2)
@@ -277,7 +280,7 @@
             delta = -delta
             newsize = oldsize + delta
             # XXX support this in rlist!
-            items += [None] * delta
+            items += [empty_elem] * delta
             lim = start+len2
             i = newsize - 1
             while i >= lim:

diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -404,7 +404,7 @@
     oldsize = len(w_bytearray.data)
     start, stop, step, slicelength = w_slice.indices4(space, oldsize)
     sequence2 = makebytearraydata_w(space, w_other)
-    setitem_slice_helper(space, w_bytearray.data, start, step, slicelength, sequence2)
+    setitem_slice_helper(space, w_bytearray.data, start, step, slicelength, sequence2, empty_elem='\x00')
 
 def delitem__Bytearray_ANY(space, w_bytearray, w_idx):
     idx = get_list_index(space, w_idx)


More information about the Pypy-commit mailing list