summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c
index d2729d4c6c..5688ef8479 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2301,12 +2301,13 @@ compiler_if(struct compiler *c, stmt_ty s)
return 0;
constant = expr_constant(s->v.If.test);
- /* constant = 0: "if 0" Leave the optimizations to
- * the pephole optimizer to check for syntax errors
- * in the block.
+ /* constant = 0: "if 0"
* constant = 1: "if 1", "if 2", ...
* constant = -1: rest */
- if (constant == 1) {
+ if (constant == 0) {
+ if (s->v.If.orelse)
+ VISIT_SEQ(c, stmt, s->v.If.orelse);
+ } else if (constant == 1) {
VISIT_SEQ(c, stmt, s->v.If.body);
} else {
if (asdl_seq_LEN(s->v.If.orelse)) {