Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch:
Changeset: r96186:4d37ac959895
Date: 2019-02-27 10:46 +0100
http://bitbucket.org/pypy/pypy/changeset/4d37ac959895/
Log: test (fails on py3) to check for the bytecode optimization of
constant tuples
diff --git a/pypy/interpreter/astcompiler/test/test_compiler.py
b/pypy/interpreter/astcompiler/test/test_compiler.py
--- a/pypy/interpreter/astcompiler/test/test_compiler.py
+++ b/pypy/interpreter/astcompiler/test/test_compiler.py
@@ -1204,3 +1204,17 @@
source = 'def f(): %s' % source
counts = self.count_instructions(source)
assert ops.BINARY_POWER not in counts
+
+ def test_constant_tuples(self):
+ source = """def f():
+ return ((u"a", 1), 2)
+ """
+ counts = self.count_instructions(source)
+ assert ops.BUILD_TUPLE not in counts
+ # also for bytes
+ source = """def f():
+ return ((b"a", 5), 5, 7, 8)
+ """
+ counts = self.count_instructions(source)
+ assert ops.BUILD_TUPLE not in counts
+
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit