]> granicus.if.org Git - python/commit
#1920: when considering a block starting by "while 0", the compiler optimized the
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>
Thu, 24 Jan 2008 23:42:08 +0000 (23:42 +0000)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>
Thu, 24 Jan 2008 23:42:08 +0000 (23:42 +0000)
commitf1a7178cd569383cbce3aba22bd7b1d5950e7c20
tree9e575034a9f6eed2ccb84329ea47414330c7caf9
parentd933e0a7d3656a0d08bedb1eddb6347fb7dda4ec
#1920: when considering a block starting by "while 0", the compiler optimized the
whole construct away, even when an 'else' clause is present::

    while 0:
        print("no")
    else:
        print("yes")

did not generate any code at all.

Now the compiler emits the 'else' block, like it already does for 'if' statements.

Backport of r60265.
Lib/test/test_grammar.py
Misc/NEWS
Python/compile.c