Author: Armin Rigo <[email protected]>
Branch: string-NUL
Changeset: r51987:300213fb2de0
Date: 2012-01-31 12:28 +0100
http://bitbucket.org/pypy/pypy/changeset/300213fb2de0/
Log: Add a test checking that the "'\x00' in s" done by space.str0() can
be constant-folded if s is a constant.
diff --git a/pypy/jit/metainterp/test/test_ajit.py
b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -322,6 +322,17 @@
res = self.interp_operations(f, [42])
assert res == ord(u"?")
+ def test_char_in_constant_string(self):
+ def g(string):
+ return '\x00' in string
+ def f():
+ if g('abcdef'): return -60
+ if not g('abc\x00ef'): return -61
+ return 42
+ res = self.interp_operations(f, [])
+ assert res == 42
+ self.check_operations_history({'finish': 1}) # nothing else
+
def test_residual_call(self):
@dont_look_inside
def externfn(x, y):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit