[pypy-commit] pypy default: Don't use range() here, because it can raise MemoryError.

arigo noreply at buildbot.pypy.org
Tue Nov 8 13:21:24 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r48922:b1d4b57f6170
Date: 2011-11-08 13:08 +0100
http://bitbucket.org/pypy/pypy/changeset/b1d4b57f6170/

Log:	Don't use range() here, because it can raise MemoryError.

diff --git a/pypy/rlib/rgc.py b/pypy/rlib/rgc.py
--- a/pypy/rlib/rgc.py
+++ b/pypy/rlib/rgc.py
@@ -163,8 +163,10 @@
                                                 source_start, dest_start,
                                                 length):
             # if the write barrier is not supported, copy by hand
-            for i in range(length):
+            i = 0
+            while i < length:
                 dest[i + dest_start] = source[i + source_start]
+                i += 1
             return
     source_addr = llmemory.cast_ptr_to_adr(source)
     dest_addr   = llmemory.cast_ptr_to_adr(dest)


More information about the pypy-commit mailing list