Author: Philip Jenvey <[email protected]>
Branch: 
Changeset: r58744:32fdb45eb9ba
Date: 2012-11-05 12:18 -0800
http://bitbucket.org/pypy/pypy/changeset/32fdb45eb9ba/

Log:    slightly rework the bytearray to float fix mostly for the sake of
        py3k

diff --git a/pypy/objspace/std/bytearrayobject.py 
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -83,14 +83,6 @@
     data = makebytearraydata_w(space, w_source)
     w_bytearray.data = data
 
-def float__Bytearray(space, w_bytearray):
-    try:
-        value = string_to_float(''.join(w_bytearray.data))
-    except ParseStringError, e:
-        raise OperationError(space.w_ValueError, space.wrap(e.msg))
-    else:
-        return space.wrap(value)
-
 def len__Bytearray(space, w_bytearray):
     result = len(w_bytearray.data)
     return wrapint(space, result)
diff --git a/pypy/objspace/std/floattype.py b/pypy/objspace/std/floattype.py
--- a/pypy/objspace/std/floattype.py
+++ b/pypy/objspace/std/floattype.py
@@ -35,8 +35,9 @@
         if space.is_w(w_floattype, space.w_float):
             return w_obj
         value = space.float_w(w_obj)
-    elif space.isinstance_w(w_value, space.w_str):
-        strvalue = space.str_w(w_value)
+    elif (space.isinstance_w(w_value, space.w_str) or
+          space.isinstance_w(w_value, space.w_bytearray)):
+        strvalue = space.bufferstr_w(w_value)
         try:
             value = string_to_float(strvalue)
         except ParseStringError, e:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to