[pypy-commit] pypy numpy-multidim: make shape and chunk immutable. no real benefits unless some array is constant.

fijal noreply at buildbot.pypy.org
Fri Oct 28 22:09:45 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-multidim
Changeset: r48591:cd07f23f15fc
Date: 2011-10-28 22:09 +0200
http://bitbucket.org/pypy/pypy/changeset/cd07f23f15fc/

Log:	make shape and chunk immutable. no real benefits unless some array
	is constant.

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
@@ -71,6 +71,8 @@
 class BaseArray(Wrappable):
     _attrs_ = ["invalidates", "signature", "shape"]
 
+    _immutable_fields_ = ['shape[*]']
+
     def __init__(self, shape):
         self.invalidates = []
         self.shape = shape
@@ -577,6 +579,8 @@
 class NDimSlice(ViewArray):
     signature = signature.BaseSignature()
     
+    _immutable_fields_ = ['shape[*]', 'chunks[*]']
+
     def __init__(self, parent, signature, chunks, shape):
         ViewArray.__init__(self, parent, signature, shape)
         self.chunks = chunks


More information about the pypy-commit mailing list