Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r55217:7e674e85e38d
Date: 2012-05-31 11:07 +0200
http://bitbucket.org/pypy/pypy/changeset/7e674e85e38d/
Log: make it possible to do int(bytearray(...)). This fixes
test_bytearrayobject.test_int
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
@@ -33,6 +33,8 @@
from pypy.objspace.std.unicodeobject import
unicode_to_decimal_w
return string_to_w_long(space, w_longtype,
unicode_to_decimal_w(space, w_value))
+ elif space.isinstance_w(w_value, space.w_bytearray):
+ return string_to_w_long(space, w_longtype,
space.bufferstr_w(w_value))
else:
# otherwise, use the __int__() or the __trunc__ methods
w_obj = w_value
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit