Author: Ronan Lamy <ronan.l...@gmail.com> Branch: less-stringly-ops Changeset: r66244:885db39402bc Date: 2013-08-10 16:50 +0100 http://bitbucket.org/pypy/pypy/changeset/885db39402bc/
Log: kill FlowObjSpace.is_true() (it's now identical to FlowObjSpace.bool()) diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -740,34 +740,34 @@ def JUMP_IF_FALSE(self, target): # Python <= 2.6 only w_cond = self.peekvalue() - if not self.guessbool(self.space.is_true(w_cond)): + if not self.guessbool(self.space.bool(w_cond)): return target def JUMP_IF_TRUE(self, target): # Python <= 2.6 only w_cond = self.peekvalue() - if self.guessbool(self.space.is_true(w_cond)): + if self.guessbool(self.space.bool(w_cond)): return target def POP_JUMP_IF_FALSE(self, target): w_value = self.popvalue() - if not self.guessbool(self.space.is_true(w_value)): + if not self.guessbool(self.space.bool(w_value)): return target def POP_JUMP_IF_TRUE(self, target): w_value = self.popvalue() - if self.guessbool(self.space.is_true(w_value)): + if self.guessbool(self.space.bool(w_value)): return target def JUMP_IF_FALSE_OR_POP(self, target): w_value = self.peekvalue() - if not self.guessbool(self.space.is_true(w_value)): + if not self.guessbool(self.space.bool(w_value)): return target self.popvalue() def JUMP_IF_TRUE_OR_POP(self, target): w_value = self.peekvalue() - if self.guessbool(self.space.is_true(w_value)): + if self.guessbool(self.space.bool(w_value)): return target self.popvalue() diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py --- a/rpython/flowspace/objspace.py +++ b/rpython/flowspace/objspace.py @@ -196,7 +196,7 @@ else: w_len = self.len(w_iterable) w_correct = self.eq(w_len, const(expected_length)) - if not self.frame.guessbool(self.is_true(w_correct)): + if not self.frame.guessbool(self.bool(w_correct)): e = self.exc_from_raise(self.w_ValueError, self.w_None) raise e return [self.frame.do_operation('getitem', w_iterable, const(i)) @@ -204,13 +204,7 @@ # ____________________________________________________________ def not_(self, w_obj): - return const(not self.frame.guessbool(self.is_true(w_obj))) - - def is_true(self, w_obj): - if w_obj.foldable(): - return const(bool(w_obj.value)) - w_truthvalue = self.frame.do_operation('bool', w_obj) - return w_truthvalue + return const(not self.frame.guessbool(self.bool(w_obj))) def iter(self, w_iterable): if isinstance(w_iterable, Constant): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit