All pastes #2053978 Raw Edit

Miscellany

public diff v1 · immutable
#2053978 ·published 2011-05-04 21:12 UTC
rendered paste body
diff -r 7838dec7ffe0 pypy/module/micronumpy/numarray.py--- a/pypy/module/micronumpy/numarray.py	Wed May 04 18:03:53 2011 +0200+++ b/pypy/module/micronumpy/numarray.py	Wed May 04 15:09:18 2011 -0600@@ -122,6 +122,11 @@                 b = frame.popvalue()                 a = frame.popvalue()                 frame.pushvalue(a * b)+            elif opcode == 's':+                # Subtract.+                b = frame.popvalue()+                a = frame.popvalue()+                frame.pushvalue(a - b)             else:                 raise NotImplementedError(                     "Can't handle bytecode instruction %s" % opcode)@@ -142,6 +147,13 @@         # (we still have to compile new bytecode, but too bad)         return compute(code) +    def descr_sub(self, space, w_other):+        if isinstance(w_other, BaseArray):+            return space.wrap(BinOp('s', self, w_other))+        else:+            return space.wrap(BinOp('s', self,+                FloatWrapper(space.float_w(w_other))))+     def descr_add(self, space, w_other):         if isinstance(w_other, BaseArray):             return space.wrap(BinOp('a', self, w_other))@@ -189,6 +201,7 @@     'Operation',     force = interp2app(BaseArray.force),     __add__ = interp2app(BaseArray.descr_add),+    __sub__ = interp2app(BaseArray.descr_sub),     __mul__ = interp2app(BaseArray.descr_mul), ) @@ -248,6 +261,7 @@     __getitem__ = interp2app(SingleDimArray.descr_getitem),     __setitem__ = interp2app(SingleDimArray.descr_setitem),     __add__ = interp2app(BaseArray.descr_add),+    __sub__ = interp2app(BaseArray.descr_sub),     __mul__ = interp2app(BaseArray.descr_mul),     force = interp2app(SingleDimArray.force), )