]> granicus.if.org Git - python/commitdiff
Fix compiler warnings about end_col_offset and end_lineno (GH-11735)
authorIvan Levkivskyi <levkivskyi@gmail.com>
Sun, 10 Feb 2019 15:39:49 +0000 (15:39 +0000)
committerGitHub <noreply@github.com>
Sun, 10 Feb 2019 15:39:49 +0000 (15:39 +0000)
Python/ast.c

index 45578a850f77cd4c50cb8a6fc8431090ad521958..4fa98b17f880db1c9ea2e4861a18bd7f4c82319b 100644 (file)
@@ -3871,11 +3871,8 @@ static void
 get_last_end_pos(asdl_seq *s, int *end_lineno, int *end_col_offset)
 {
     int tot = asdl_seq_LEN(s);
-    // Suite should not be empty, but it is safe to just ignore it
-    // if it will ever occur.
-    if (!tot) {
-        return;
-    }
+    // There must be no empty suites.
+    assert(tot > 0);
     stmt_ty last = asdl_seq_GET(s, tot - 1);
     *end_lineno = last->end_lineno;
     *end_col_offset = last->end_col_offset;