Author: Matti Picus <[email protected]>
Branch: buffer-interface
Changeset: r86807:6ee997b509c7
Date: 2016-09-01 08:45 +0300
http://bitbucket.org/pypy/pypy/changeset/6ee997b509c7/

Log:    this was wrong. if arr.base and dtype='O', simply assume the
        pointers are gc objects

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
@@ -465,13 +465,6 @@
         self.storage = storage
         self.start = start
         self.gcstruct = V_OBJECTSTORE
-        if dtype.num == NPY.OBJECT:
-            self.gcstruct = _create_objectstore(storage, self.size,
-                                                dtype.elsize)
-
-    def __del__(self):
-        if self.gcstruct:
-            self.gcstruct.length = 0
 
     def fill(self, space, box):
         self.dtype.itemtype.fill(
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -1851,7 +1851,7 @@
                     arr.gcstruct)
 
     def read(self, arr, i, offset, dtype):
-        if arr.gcstruct is V_OBJECTSTORE:
+        if arr.gcstruct is V_OBJECTSTORE and not arr.base():
             raise oefmt(self.space.w_NotImplementedError,
                 "cannot read object from array with no gc hook")
         return self.box(self._read(arr.storage, i, offset))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to