[pypy-commit] pypy py3k: fix parsing of complex numbers by using unicode instead of strings

antocuni noreply at buildbot.pypy.org
Wed Jul 18 22:09:36 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r56194:835130082aa6
Date: 2012-07-18 21:42 +0200
http://bitbucket.org/pypy/pypy/changeset/835130082aa6/

Log:	fix parsing of complex numbers by using unicode instead of strings

diff --git a/pypy/objspace/std/complextype.py b/pypy/objspace/std/complextype.py
--- a/pypy/objspace/std/complextype.py
+++ b/pypy/objspace/std/complextype.py
@@ -1,3 +1,4 @@
+from pypy.tool.sourcetools import with_unicode_literals
 from pypy.interpreter import gateway
 from pypy.interpreter.error import OperationError, operationerrfmt
 from pypy.objspace.std.register_all import register_all
@@ -16,6 +17,7 @@
 
 register_all(vars(),globals())
 
+ at with_unicode_literals
 def _split_complex(s):
     slen = len(s)
     if slen == 0:
@@ -135,7 +137,7 @@
                                  space.wrap("complex() can't take second arg"
                                             " if first is a string"))
         try:
-            realstr, imagstr = _split_complex(space.str_w(w_real))
+            realstr, imagstr = _split_complex(space.unicode_w(w_real))
         except ValueError:
             raise OperationError(space.w_ValueError, space.wrap(ERR_MALFORMED))
         try:


More information about the pypy-commit mailing list