summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorMilan Rossa <rossa.milan@gmail.com>2019-08-19 14:16:33 +0200
committerDamien George <damien.p.george@gmail.com>2019-08-19 23:50:30 +1000
commitae6fe8b43c08abe215dde355e04e561ad2dd1808 (patch)
tree77ed190558c11f3747cd4a1260a26a2f449d8b7b /py
parent7d851a27f146188752e89bb026021fb8d3985395 (diff)
py/compile: Improve the line numbering precision for comprehensions.
The line number for comprehensions is now always reported as the correct global location in the script, instead of just "line 1".
Diffstat (limited to 'py')
-rw-r--r--py/compile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/compile.c b/py/compile.c
index 27b706c8f..c0ae3de11 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3112,6 +3112,9 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
scope->num_pos_args = 1;
}
+ // Set the source line number for the start of the comprehension
+ EMIT_ARG(set_source_line, pns->source_line);
+
if (scope->kind == SCOPE_LIST_COMP) {
EMIT_ARG(build, 0, MP_EMIT_BUILD_LIST);
} else if (scope->kind == SCOPE_DICT_COMP) {