]> granicus.if.org Git - python/commit
bpo-37269: Correctly optimise conditionals with constant booleans (GH-14071)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 14 Jun 2019 06:13:24 +0000 (23:13 -0700)
committerGitHub <noreply@github.com>
Fri, 14 Jun 2019 06:13:24 +0000 (23:13 -0700)
commit7cd581a6bf82309b3c9b9251c54067d442732485
treecaf61efc5b45cc164db9d301d600216a63b87df0
parent886d83e5aa8df2dd2e93421d2f614438a3244a1c
bpo-37269: Correctly optimise conditionals with constant booleans (GH-14071)

Fix a regression introduced by af8646c8054d0f4180a2013383039b6a472f9698 that was causing code of the form:

if True and False:
   do_something()

to be optimized incorrectly, eliminating the block.
(cherry picked from commit 05f831865545b08c9a21cfb7773af58b76ec64cb)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Lib/test/test_peepholer.py
Misc/NEWS.d/next/Core and Builtins/2019-06-14-06-32-33.bpo-37269.SjVVAe.rst [new file with mode: 0644]
Python/peephole.c