[pypy-svn] r10273 - pypy/dist/pypy/objspace/std

tismer at codespeak.net tismer at codespeak.net
Sun Apr 3 20:39:28 CEST 2005


Author: tismer
Date: Sun Apr  3 20:39:28 2005
New Revision: 10273

Modified:
   pypy/dist/pypy/objspace/std/listobject.py
Log:
avoiding side effects during deletion of list slices

Modified: pypy/dist/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listobject.py	(original)
+++ pypy/dist/pypy/objspace/std/listobject.py	Sun Apr  3 20:39:28 2005
@@ -439,11 +439,9 @@
         ihigh = w_list.ob_size
     items = w_list.ob_item
     d = ihigh-ilow
-    # XXX this is done by CPython to hold the elements
-    # to be deleted. I have no idea how to express
-    # this here, but we need to be aware when we write
-    # a compiler.
-    # recycle = [items[i] for i in range(ilow, ihigh)]
+    # keep a reference to the objects to be removed,
+    # preventing side effects during destruction
+    recycle = [items[i] for i in range(ilow, ihigh)]
     for i in range(ilow, w_list.ob_size - d):
         items[i] = items[i+d]
         items[i+d] = None



More information about the Pypy-commit mailing list