[Python-checkins] Fix compiler warnings about end_col_offset and end_lineno (GH-11735)

Ivan Levkivskyi webhook-mailer at python.org
Sun Feb 10 10:39:58 EST 2019


https://github.com/python/cpython/commit/181835d5a9bffee247bc2f7eefc778c1812bc982
commit: 181835d5a9bffee247bc2f7eefc778c1812bc982
branch: master
author: Ivan Levkivskyi <levkivskyi at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-02-10T15:39:49Z
summary:

Fix compiler warnings about end_col_offset and end_lineno (GH-11735)

files:
M Python/ast.c

diff --git a/Python/ast.c b/Python/ast.c
index 45578a850f77..4fa98b17f880 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -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;



More information about the Python-checkins mailing list