Author: Amaury Forgeot d'Arc <[email protected]>
Branch: 
Changeset: r55215:b65c7f2cd001
Date: 2012-05-31 00:02 +0200
http://bitbucket.org/pypy/pypy/changeset/b65c7f2cd001/

Log:    Fix long(unicode, base) with unicode Ropes.

        [Problem seen in the py3k branch, with int(str, base)]

diff --git a/pypy/objspace/std/longtype.py b/pypy/objspace/std/longtype.py
--- a/pypy/objspace/std/longtype.py
+++ b/pypy/objspace/std/longtype.py
@@ -52,7 +52,10 @@
         base = space.int_w(w_base)
 
         if space.isinstance_w(w_value, space.w_unicode):
-            from pypy.objspace.std.unicodeobject import unicode_to_decimal_w
+            if space.config.objspace.std.withropeunicode:
+                from pypy.objspace.std.ropeunicodeobject import 
unicode_to_decimal_w
+            else:
+                from pypy.objspace.std.unicodeobject import 
unicode_to_decimal_w
             s = unicode_to_decimal_w(space, w_value)
         else:
             try:
diff --git a/pypy/objspace/std/test/test_unicodeobject.py 
b/pypy/objspace/std/test/test_unicodeobject.py
--- a/pypy/objspace/std/test/test_unicodeobject.py
+++ b/pypy/objspace/std/test/test_unicodeobject.py
@@ -304,6 +304,7 @@
     def test_long_from_unicode(self):
         assert long(u'12345678901234567890') == 12345678901234567890
         assert int(u'12345678901234567890') == 12345678901234567890
+        assert long(u'123', 7) == 66
 
     def test_int_from_unicode(self):
         assert int(u'12345') == 12345
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to