Author: stian
Branch: math-improvements
Changeset: r92803:62ba73fa6cac
Date: 2017-10-19 22:47 +0200
http://bitbucket.org/pypy/pypy/changeset/62ba73fa6cac/

Log:    Make use of int_sub in longobjects

diff --git a/pypy/objspace/std/longobject.py b/pypy/objspace/std/longobject.py
--- a/pypy/objspace/std/longobject.py
+++ b/pypy/objspace/std/longobject.py
@@ -395,10 +395,14 @@
         methname = opname + '_' if opname in ('and', 'or') else opname
         descr_rname = 'descr_r' + opname
         op = getattr(rbigint, methname)
+        intop = getattr(rbigint, 'int_' + methname)
 
         @func_renamer('descr_' + opname)
-        @delegate_other
         def descr_binop(self, space, w_other):
+            if isinstance(w_other, W_AbstractIntObject):
+                return W_LongObject(intop(self.num, w_other.int_w(space)))
+            elif not isinstance(w_other, W_AbstractLongObject):
+                return space.w_NotImplemented
             return W_LongObject(op(self.num, w_other.asbigint()))
 
         @func_renamer(descr_rname)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to