[Python-Dev] Suggest reverting today's checkin (recursive constant folding in the peephole optimizer)

Eugene Toder eltoder at gmail.com
Sat Mar 12 07:15:03 CET 2011


> One note on the patch: it allocates an extra stack which is dynamically grown;
> but there is no unittest to exercise the stack-growing code.

Isn't this doing it?

1.20 +        # Long tuples should be folded too.
1.21 +        asm = dis_single(repr(tuple(range(10000))))
1.22 +        # One LOAD_CONST for the tuple, one for the None return value
1.23 +        self.assertEqual(asm.count('LOAD_CONST'), 2)
1.24 +        self.assertNotIn('BUILD_TUPLE', asm)

Eugene


More information about the Python-Dev mailing list