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 serhiy.storchaka
Recipients benjamin.peterson, brett.cannon, ncoghlan, rhettinger, serhiy.storchaka, yselivanov
Date 2017-05-29.07:43:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
It would be hard to get the same optimization in the peepholer.

For the first example, "if not a and b:", it is easy, just replace UNARY_NOT+POP_JUMP_IF_FALSE with POP_JUMP_IF_TRUE. The more complex third example, "if not (a and b) and c:", would need multiple passes (and more complex examples can need more passes, having the quadratic complexity in corner cases). The second example, with chained comparisons, is the most complex. It uses the fact that after the conditional jump and some stack operations we got a false value on the stack. This is too complex for the peepholer.
Date User Action Args
2017-05-29 07:43:21serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, rhettinger, ncoghlan, benjamin.peterson, yselivanov
2017-05-29 07:43:21serhiy.storchakasetmessageid: <>
2017-05-29 07:43:21serhiy.storchakalinkissue30501 messages
2017-05-29 07:43:21serhiy.storchakacreate