Author: Brian Kearns <[email protected]>
Branch: 
Changeset: r69942:154545271aa6
Date: 2014-03-13 18:36 -0400
http://bitbucket.org/pypy/pypy/changeset/154545271aa6/

Log:    only set self.storage once here

diff --git a/pypy/module/micronumpy/concrete.py 
b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -368,13 +368,10 @@
 
 class ConcreteArray(ConcreteArrayNotOwning):
     def __init__(self, shape, dtype, order, strides, backstrides, 
storage=lltype.nullptr(RAW_STORAGE)):
-        null_storage = lltype.nullptr(RAW_STORAGE)
+        if storage == lltype.nullptr(RAW_STORAGE):
+            storage = dtype.itemtype.malloc(support.product(shape) * 
dtype.elsize)
         ConcreteArrayNotOwning.__init__(self, shape, dtype, order, strides, 
backstrides,
-                                        null_storage)
-        if storage == lltype.nullptr(RAW_STORAGE):
-            self.storage = dtype.itemtype.malloc(self.size)
-        else:
-            self.storage = storage
+                                        storage)
 
     def __del__(self):
         free_raw_storage(self.storage, track_allocation=False)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to