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

arigo at codespeak.net arigo at codespeak.net
Mon May 8 23:17:06 CEST 2006


Author: arigo
Date: Mon May  8 23:17:04 2006
New Revision: 26983

Modified:
   pypy/dist/pypy/rpython/rlist.py
Log:
(pedronis, arigo)
Bug fix: checking for "a memory pattern of zero" isn't so obvious.


Modified: pypy/dist/pypy/rpython/rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/rlist.py	(original)
+++ pypy/dist/pypy/rpython/rlist.py	Mon May  8 23:17:04 2006
@@ -3,7 +3,8 @@
 from pypy.annotation import model as annmodel
 from pypy.rpython.rmodel import Repr, IteratorRepr, IntegerRepr, inputconst
 from pypy.rpython.rslice import AbstractSliceRepr
-from pypy.rpython.lltypesystem.lltype import typeOf, Ptr, Void, Signed, Bool, nullptr
+from pypy.rpython.lltypesystem.lltype import typeOf, Ptr, Void, Signed, Bool
+from pypy.rpython.lltypesystem.lltype import nullptr, Char, UniChar
 from pypy.rpython import robject
 
 def dum_checkidx(): pass
@@ -350,7 +351,12 @@
     if count < 0:
         count = 0
     l = LIST.ll_newlist(count)
-    if item: # as long as malloc it is known to zero the allocated memory avoid zeroing twice
+    T = typeOf(item)
+    if T is Char or T is UniChar:
+        check = ord(item)
+    else:
+        check = item
+    if check: # as long as malloc it is known to zero the allocated memory avoid zeroing twice
         i = 0
         while i < count:
             l.ll_setitem_fast(i, item)



More information about the Pypy-commit mailing list