Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r78878:167c83453673 Date: 2015-08-11 10:13 +0100 http://bitbucket.org/pypy/pypy/changeset/167c83453673/
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 pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit