[pypy-svn] rev 2052 - in pypy/trunk/src/pypy: objspace/flow translator

arigo at codespeak.net arigo at codespeak.net
Sat Oct 25 18:03:21 CEST 2003


Author: arigo
Date: Sat Oct 25 18:03:21 2003
New Revision: 2052

Modified:
   pypy/trunk/src/pypy/objspace/flow/objspace.py
   pypy/trunk/src/pypy/translator/annotation.py
Log:
The flow space now emits an explicit 'is_true' operation.


Modified: pypy/trunk/src/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/objspace.py	(original)
+++ pypy/trunk/src/pypy/objspace/flow/objspace.py	Sat Oct 25 18:03:21 2003
@@ -81,8 +81,9 @@
             pass
         else:
             return bool(obj)
+        w_truthvalue = self.do_operation('is_true', w_obj)
         context = self.getexecutioncontext()
-        return context.guessbool(w_obj)
+        return context.guessbool(w_truthvalue)
 
     def next(self, w_iter):
         w_tuple = self.do_operation("next_and_flag", w_iter)

Modified: pypy/trunk/src/pypy/translator/annotation.py
==============================================================================
--- pypy/trunk/src/pypy/translator/annotation.py	(original)
+++ pypy/trunk/src/pypy/translator/annotation.py	Sat Oct 25 18:03:21 2003
@@ -107,9 +107,11 @@
     consider_op_and_ = consider_op_add   # don't forget the trailing '_'
     # XXX add more
 
-    def consider_op_not_(self, op, annotations):
+    def consider_op_is_true(self, op, annotations):
         annotations.set_type(op.result, bool)
 
+    consider_op_not_ = consider_op_is_true
+
     def consider_op_lt(self, op, annotations):
         annotations.set_type(op.result, bool)
 


More information about the Pypy-commit mailing list