[pypy-commit] pypy default: use the internal copy, rather than reinstantiate, faster.

alex_gaynor noreply at buildbot.pypy.org
Mon Nov 28 12:53:42 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r49895:4ef4547fa441
Date: 2011-11-28 06:53 -0500
http://bitbucket.org/pypy/pypy/changeset/4ef4547fa441/

Log:	use the internal copy, rather than reinstantiate, faster.

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -726,12 +726,11 @@
             concrete.setitem_w(space, item, w_value)
             return
         if isinstance(w_value, BaseArray):
-            # for now we just copy if setting part of an array from
-            # part of itself. can be improved.
+            # for now we just copy if setting part of an array from part of
+            # itself. can be improved.
             if (concrete.get_root_storage() ==
                 w_value.get_concrete().get_root_storage()):
-                w_value = space.call_function(space.gettypefor(BaseArray), w_value)
-                assert isinstance(w_value, BaseArray)
+                w_value = w_value.descr_copy(space)
         else:
             w_value = convert_to_array(space, w_value)
         chunks = self._prepare_slice_args(space, w_idx)


More information about the pypy-commit mailing list