Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r55218:b5cc44baeb21
Date: 2012-05-31 11:12 +0200
http://bitbucket.org/pypy/pypy/changeset/b5cc44baeb21/

Log:    failing test&fix. I think that bufferstr_w is what we want, not
        str_w; it makes a difference e.g. for bytearray and memoryview

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
@@ -55,7 +55,7 @@
             s = unicode_to_decimal_w(space, w_value)
         else:
             try:
-                s = space.str_w(w_value)
+                s = space.bufferstr_w(w_value)
             except OperationError, e:
                 raise OperationError(space.w_TypeError,
                                      space.wrap("long() can't convert 
non-string "
diff --git a/pypy/objspace/std/test/test_bytearrayobject.py 
b/pypy/objspace/std/test/test_bytearrayobject.py
--- a/pypy/objspace/std/test/test_bytearrayobject.py
+++ b/pypy/objspace/std/test/test_bytearrayobject.py
@@ -434,6 +434,7 @@
 
     def test_int(self):
         assert int(bytearray(b'-1234')) == -1234
+        assert int(bytearray(b'10'), 16) == 16
 
     def test_reduce(self):
         assert bytearray(b'caf\xe9').__reduce__() == (
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to