Commits

Brian Kearns  committed 1545452

only set self.storage once here

  • Participants
  • Parent commits 2a1dbb0

Comments (0)

Files changed (1)

File pypy/module/micronumpy/concrete.py

 
 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)