[pypy-commit] pypy decimal-libmpdec: Add Context.clear_flags()

amauryfa noreply at buildbot.pypy.org
Sun May 11 00:27:57 CEST 2014


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: decimal-libmpdec
Changeset: r71465:739252dd6bf7
Date: 2014-05-10 23:08 +0200
http://bitbucket.org/pypy/pypy/changeset/739252dd6bf7/

Log:	Add Context.clear_flags()

diff --git a/pypy/module/_decimal/interp_context.py b/pypy/module/_decimal/interp_context.py
--- a/pypy/module/_decimal/interp_context.py
+++ b/pypy/module/_decimal/interp_context.py
@@ -120,6 +120,12 @@
         w_copy.capitals = self.capitals
         return w_copy
 
+    def clear_flags_w(self, space):
+        rffi.setintfield(self.ctx, 'c_status', 0)
+
+    def clear_traps_w(self, space):
+        rffi.setintfield(self.ctx, 'c_traps', 0)
+
     def get_prec(self, space):
         return space.wrap(rmpdec.mpd_getprec(self.ctx))
 
@@ -226,6 +232,8 @@
     __repr__ = interp2app(W_Context.descr_repr),
     #
     copy=interp2app(W_Context.copy_w),
+    clear_flags=interp2app(W_Context.clear_flags_w),
+    clear_traps=interp2app(W_Context.clear_traps_w),
     create_decimal=interp2app(W_Context.create_decimal_w),
     )
 


More information about the pypy-commit mailing list