Author: Armin Rigo <[email protected]>
Branch: vecopt-merge
Changeset: r78883:9299faf9cad1
Date: 2015-08-11 10:13 +0100
http://bitbucket.org/pypy/pypy/changeset/9299faf9cad1/
Log: Fix for df216970b57e: we now expect ".intval" to be really an int,
never a bool
diff --git a/pypy/objspace/std/boolobject.py b/pypy/objspace/std/boolobject.py
--- a/pypy/objspace/std/boolobject.py
+++ b/pypy/objspace/std/boolobject.py
@@ -13,7 +13,7 @@
class W_BoolObject(W_IntObject):
def __init__(self, boolval):
- self.intval = not not boolval
+ self.intval = int(not not boolval)
def __nonzero__(self):
raise Exception("you cannot do that, you must use space.is_true()")
diff --git a/pypy/objspace/std/test/test_boolobject.py
b/pypy/objspace/std/test/test_boolobject.py
--- a/pypy/objspace/std/test/test_boolobject.py
+++ b/pypy/objspace/std/test/test_boolobject.py
@@ -4,6 +4,10 @@
self.false = self.space.w_False
self.wrap = self.space.wrap
+ def test_init(self):
+ assert (self.false.intval, type(self.false.intval)) == (0, int)
+ assert (self.true.intval, type(self.true.intval)) == (1, int)
+
def test_repr(self):
assert self.space.eq_w(self.space.repr(self.true), self.wrap("True"))
assert self.space.eq_w(self.space.repr(self.false), self.wrap("False"))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit