Author: Amaury Forgeot d'Arc <[email protected]>
Branch: decimal-libmpdec
Changeset: r73043:81d69df48cb2
Date: 2014-05-25 21:52 +0200
http://bitbucket.org/pypy/pypy/changeset/81d69df48cb2/

Log:    Decimal.__trunc__

diff --git a/pypy/module/_decimal/interp_decimal.py 
b/pypy/module/_decimal/interp_decimal.py
--- a/pypy/module/_decimal/interp_decimal.py
+++ b/pypy/module/_decimal/interp_decimal.py
@@ -221,6 +221,10 @@
         context = interp_context.getcontext(space)
         return self.to_long(space, context, rmpdec.MPD_ROUND_DOWN)
         
+    def descr_trunc(self, space):
+        context = interp_context.getcontext(space)
+        return self.to_long(space, context, rmpdec.MPD_ROUND_DOWN)
+        
     def descr_floor(self, space):
         context = interp_context.getcontext(space)
         return self.to_long(space, context, rmpdec.MPD_ROUND_FLOOR)
@@ -815,6 +819,7 @@
     __bool__ = interp2app(W_Decimal.descr_bool),
     __float__ = interp2app(W_Decimal.descr_float),
     __int__ = interp2app(W_Decimal.descr_int),
+    __trunc__ = interp2app(W_Decimal.descr_trunc),
     __floor__ = interp2app(W_Decimal.descr_floor),
     __ceil__ = interp2app(W_Decimal.descr_ceil),
     __round__ = interp2app(W_Decimal.descr_round),
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to