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

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Mar 14 15:45:09 CET 2011


On Fri, Mar 11, 2011 at 9:53 PM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
> On Fri, Mar 11, 2011 at 9:28 PM, Raymond Hettinger
> <raymond.hettinger at gmail.com> wrote:
>> Today, there was a significant check-in to the peephole optimizer that I
>> think should be reverted:
>>                http://hg.python.org/cpython/rev/14205d0fee45/
>
> +1
>
> I was going to comment on the corresponding issue #11244 more or less
> supporting Raymond's arguments.

When I wrote this, I was actually looking at the issue 11462.  I now
realize that #11462 was in fact closed as "rejected".

I am still confused, however, about [14205d0fee45].  The commit
message refers to "Issue #11244", but the comment does not match the
subject of the tracker issue:

"""
Issue #11244: The peephole optimizer is now able to constant-fold
arbitrarily complex expressions. This also fixes a 3.2 regression where
operations involving negative numbers were not constant-folded.
"""

I think issue #11244 is just the second part: "a 3.2 regression where
operations involving negative numbers were not constant-folded."

If this is the case, what is left to do for #11244?  The bug reported
in that issue seem to have been fixed:

>>> dis(lambda: (1,-2,3))
  1           0 LOAD_CONST               5 ((1, -2, 3))
              3 RETURN_VALUE


More information about the Python-Dev mailing list