Author: Ronan Lamy <[email protected]>
Branch: translation-cleanup
Changeset: r57631:83ad747e900b
Date: 2012-09-27 07:22 +0100
http://bitbucket.org/pypy/pypy/changeset/83ad747e900b/
Log: Add missing FlowObjSpace.not_(), with test
diff --git a/pypy/objspace/flow/objspace.py b/pypy/objspace/flow/objspace.py
--- a/pypy/objspace/flow/objspace.py
+++ b/pypy/objspace/flow/objspace.py
@@ -335,6 +335,9 @@
operation.implicit_exceptions.get(name))
return w_result
+ def not_(self, w_obj):
+ return self.wrap(not self.is_true(w_obj))
+
def is_true(self, w_obj):
try:
obj = self.unwrap_for_computation(w_obj)
diff --git a/pypy/objspace/flow/test/test_objspace.py
b/pypy/objspace/flow/test/test_objspace.py
--- a/pypy/objspace/flow/test/test_objspace.py
+++ b/pypy/objspace/flow/test/test_objspace.py
@@ -509,6 +509,12 @@
assert len(op.args) == 2
assert op.args[1].value == 3
+ def test_unary_ops(self):
+ def f(x):
+ return not ~-x
+ graph = self.codetest(f)
+ assert self.all_operations(graph) == {'is_true':1, 'invert':1, 'neg':1}
+
#__________________________________________________________
def wearetranslated(x):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit