Closed
Description
Running the following code with numpy 1.8.1
import numpy
class C(object):
def __index__(self):
return 0
def __len__(self):
return 1
def __getitem__(self, item):
raise IndexError
x = numpy.array([1])
i = C()
print(repr(x[i]))
I get
*** Reference count error detected:
an attempt was made to deallocate 5 (i) ***
Traceback (most recent call last):
File "x.py", line 13, in <module>
print(x[i])
File "x.py", line 9, in __getitem__
raise NotImplementedError
NotImplementedError
With 1.9.0, I don't get a reference error, but the result is still wrong:
array([1])
(I expect 1
.)
Metadata
Metadata
Assignees
Labels
No labels