This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brandtbucher
Recipients Mark.Shannon, brandtbucher
Date 2021-11-09.19:56:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The following code hangs during compilation on 3.11 and 3.10:

>>> while True or spam: pass

Our peepholer gets stuck in a loop, repeatedly "optimizing" instruction 4 (POP_JUMP_IF_TRUE -> JUMP_ABSOLUTE):

  1           0 JUMP_ABSOLUTE            0 (to 0)
              2 LOAD_NAME                0 (spam)
              4 POP_JUMP_IF_TRUE         0 (to 0)

After optimizing jumps to jumps like these, we always back up and attempt to optimize the same instruction again (which makes it possible to optimize three or more chained jumps on the same line). The issue is that this particular optimization doesn't actually change the instruction, since both jumps target the same exact block. Since nothing changes, we loop forever.

The fix is really simple: just skip the optimization if instr->i_target == target->i_target. We already do this for several other types of jumps; it just looks like POP_JUMP_IF_TRUE and POP_JUMP_IF_FALSE might have been missed.

I'll have a PR up soon.
Date User Action Args
2021-11-09 19:56:22brandtbuchersetrecipients: + brandtbucher, Mark.Shannon
2021-11-09 19:56:22brandtbuchersetmessageid: <>
2021-11-09 19:56:22brandtbucherlinkissue45773 messages
2021-11-09 19:56:22brandtbuchercreate