#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.
diff --git a/Misc/NEWS b/Misc/NEWS
index 8b0084a..4913c79 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,11 @@
Core and builtins
-----------------
+- Issue #1920: "while 0" statements were completely removed by the compiler,
+ even in the presence of an "else" clause, which is supposed to be run when
+ the condition is false. Now the compiler correctly emits bytecode for the
+ "else" suite.
+
- A few crashers fixed: weakref_in_del.py (issue #1377858);
loosing_dict_ref.py (issue #1303614, test67.py);
borrowed_ref_[34].py (not in tracker).