Author: Amaury Forgeot d'Arc <[email protected]>
Branch: decimal-libmpdec
Changeset: r73594:237e55507f16
Date: 2014-09-16 11:15 +0200
http://bitbucket.org/pypy/pypy/changeset/237e55507f16/

Log:    Translation fixes.

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
@@ -1,6 +1,7 @@
 from rpython.rlib import rmpdec
 from rpython.rlib.unroll import unrolling_iterable
 from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.tool.sourcetools import func_renamer
 from pypy.interpreter.error import oefmt, OperationError
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.gateway import interp2app, unwrap_spec
@@ -288,9 +289,10 @@
     W_Context.__init__(w_result, space)
     return w_result
 
-def make_unary_method(mpd_func_name):
+def make_unary_method(mpd_func_name, tag=''):
     mpd_func = getattr(rmpdec, mpd_func_name)
     @unwrap_spec(w_context=W_Context)
+    @func_renamer('descr_%s%s' % (mpd_func_name, tag))
     def func_w(space, w_context, w_x):
         from pypy.module._decimal import interp_decimal
         w_a = interp_decimal.convert_op_raise(space, w_context, w_x)
@@ -303,6 +305,7 @@
 def make_binary_method(mpd_func_name):
     mpd_func = getattr(rmpdec, mpd_func_name)
     @unwrap_spec(w_context=W_Context)
+    @func_renamer('descr_%s' % mpd_func_name)
     def func_w(space, w_context, w_x, w_y):
         from pypy.module._decimal import interp_decimal
         w_a, w_b = interp_decimal.convert_binop_raise(
@@ -316,6 +319,7 @@
 def make_bool_method(mpd_func_name):
     mpd_func = getattr(rmpdec, mpd_func_name)
     @unwrap_spec(w_context=W_Context)
+    @func_renamer('descr_%s' % mpd_func_name)
     def func_w(space, w_context, w_x):
         from pypy.module._decimal import interp_decimal
         w_x = interp_decimal.convert_op_raise(space, w_context, w_x)
@@ -326,6 +330,7 @@
 def make_bool_method_noctx(mpd_func_name):
     mpd_func = getattr(rmpdec, mpd_func_name)
     @unwrap_spec(w_context=W_Context)
+    @func_renamer('descr_%s' % mpd_func_name)
     def func_w(space, w_context, w_x):
         from pypy.module._decimal import interp_decimal
         w_x = interp_decimal.convert_op_raise(space, w_context, w_x)
@@ -366,7 +371,7 @@
     plus=make_unary_method('mpd_qplus'),
     to_integral=make_unary_method('mpd_qround_to_int'),
     to_integral_exact=make_unary_method('mpd_qround_to_intx'),
-    to_integral_value=make_unary_method('mpd_qround_to_int'),
+    to_integral_value=make_unary_method('mpd_qround_to_int', tag='value'),
     sqrt=make_unary_method('mpd_qsqrt'),
     logical_invert=make_unary_method('mpd_qinvert'),
     # Binary Operations
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
@@ -2,6 +2,7 @@
 from rpython.rlib.objectmodel import specialize
 from rpython.rlib.rstring import StringBuilder
 from rpython.rtyper.lltypesystem import rffi, lltype
+from rpython.tool.sourcetools import func_renamer
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import oefmt, OperationError
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
@@ -519,6 +520,7 @@
 
 def make_unary_number_method(mpd_func_name):
     mpd_func = getattr(rmpdec, mpd_func_name)
+    @func_renamer('descr_%s' % mpd_func_name)
     def descr_method(space, w_self):
         self = space.interp_w(W_Decimal, w_self)
         context = interp_context.getcontext(space)
@@ -541,12 +543,14 @@
 
 def make_binary_number_method(mpd_func_name):
     mpd_func = getattr(rmpdec, mpd_func_name)
+    @func_renamer('descr_%s' % mpd_func_name)
     def descr_method(space, w_self, w_other):
         return binary_number_method(space, mpd_func, w_self, w_other)
     return interp2app(descr_method)
 
 def make_binary_number_method_right(mpd_func_name):
     mpd_func = getattr(rmpdec, mpd_func_name)
+    @func_renamer('descr_r_%s' % mpd_func_name)
     def descr_method(space, w_self, w_other):
         return binary_number_method(space, mpd_func, w_other, w_self)
     return interp2app(descr_method)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to