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".
This commit is contained in:
committed by
Damien George
parent
7d851a27f1
commit
ae6fe8b43c
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user