Commits

Philip Jenvey committed 6c7dc56

backout b40380d0b61e (kill __long__) for py3k

Comments (0)

Files changed (3)

pypy/module/micronumpy/interp_boxes.py

         assert isinstance(box, W_LongBox)
         return space.wrap(box.value)
 
-    def descr_long(self, space):
-        box = self.convert_to(W_Int64Box._get_dtype(space))
-        assert isinstance(box, W_Int64Box)
-        return space.wrap(box.value)
-
     def descr_float(self, space):
         box = self.convert_to(W_Float64Box._get_dtype(space))
         assert isinstance(box, W_Float64Box)
     __repr__ = interp2app(W_GenericBox.descr_str),
     __format__ = interp2app(W_GenericBox.descr_format),
     __int__ = interp2app(W_GenericBox.descr_int),
-    __long__ = interp2app(W_GenericBox.descr_long),
     __float__ = interp2app(W_GenericBox.descr_float),
     __bool__ = interp2app(W_GenericBox.descr_nonzero),
 

pypy/module/micronumpy/interp_numarray.py

             return space.int(self.descr_getitem(space, space.wrap(0)))
         raise OperationError(space.w_TypeError, space.wrap("only length-1 arrays can be converted to Python scalars"))
 
-    def descr_long(self, space):
-        shape = self.get_shape()
-        if len(shape) == 0:
-            assert isinstance(self.implementation, scalar.Scalar)
-            return space.long(space.wrap(self.implementation.get_scalar_value()))
-        if shape == [1]:
-            return space.int(self.descr_getitem(space, space.wrap(0)))
-        raise OperationError(space.w_TypeError, space.wrap("only length-1 arrays can be converted to Python scalars"))
-
     def descr_float(self, space):
         shape = self.get_shape()
         if len(shape) == 0:
     __repr__ = interp2app(W_NDimArray.descr_repr),
     __str__ = interp2app(W_NDimArray.descr_str),
     __int__ = interp2app(W_NDimArray.descr_int),
-    __long__ = interp2app(W_NDimArray.descr_long),
     __float__ = interp2app(W_NDimArray.descr_float),
 
     __pos__ = interp2app(W_NDimArray.descr_pos),

pypy/module/micronumpy/test/test_numarray.py

         b = array([1, 2, 3, 4])
         assert (a == b) == False
 
-    def test__long__(self):
-        from numpypy import array
-        assert long(array(1)) == 1
-        assert long(array([1])) == 1
-        assert isinstance(long(array([1])), long)
-        assert isinstance(long(array([1, 2][0])), long)
-        assert raises(TypeError, "long(array([1, 2]))")
-        assert long(array([1.5])) == 1
-
     def test__int__(self):
         from numpypy import array
         assert int(array(1)) == 1