Author: Amaury Forgeot d'Arc <[email protected]>
Branch: decimal-libmpdec
Changeset: r73050:9c253f67327d
Date: 2014-08-24 22:21 +0200
http://bitbucket.org/pypy/pypy/changeset/9c253f67327d/

Log:    Kill the ztranslation hack, I found the reason: with the
        FakeObjectSpace, no subclass of W_Root should be annotated, unless
        we also annotate its constructor.

        Use the virtual method call instead of isinstance().

diff --git a/pypy/module/_decimal/test/test_ztranslation.py 
b/pypy/module/_decimal/test/test_ztranslation.py
--- a/pypy/module/_decimal/test/test_ztranslation.py
+++ b/pypy/module/_decimal/test/test_ztranslation.py
@@ -1,11 +1,6 @@
 
 from pypy.objspace.fake.checkmodule import checkmodule
-from pypy.interpreter.mixedmodule import getinterpevalloader
-from pypy.module._decimal import Module
 
 def test_checkmodule():
-    Module.buildloaders()
-    Module.loaders['__hack'] = getinterpevalloader(
-        'pypy.objspace.std', 'unicodeobject.W_UnicodeObject(u"")')
     checkmodule('_decimal')
 
diff --git a/pypy/objspace/std/unicodeobject.py 
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -1151,9 +1151,7 @@
 # to PyUnicode_TransformDecimalToASCII, which is much simpler. Here, we do the
 # equivalent plus the final step of encoding the result to utf-8.
 def unicode_to_decimal_w(space, w_unistr):
-    if not isinstance(w_unistr, W_UnicodeObject):
-        raise oefmt(space.w_TypeError, "expected unicode, got '%T'", w_unistr)
-    unistr = w_unistr._value
+    unistr = w_unistr.unicode_w(space)
     result = [u'\0'] * len(unistr)
     for i in xrange(len(unistr)):
         uchr = ord(unistr[i])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to