Skip to content

Commit

Permalink
Support empty lines on the repl
Browse files Browse the repository at this point in the history
They end up generating "pass" statements with a lineno of 0, which
trips an assert later on.  This commit just sets them to have a lineno
of 1.
  • Loading branch information
kmod committed Aug 1, 2016
1 parent 82c402a commit 0b387db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/codegen/cpython_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,13 @@ class Converter {
auto r = _convert(stmt);
r->lineno = stmt->lineno;
r->col_offset = stmt->col_offset;

if (stmt->lineno == 0) {
// So far it looks like these can only be generated for empty lines on the repl
assert(stmt->kind == Pass_kind);
r->lineno = 1;
}

return r;
}

Expand Down

0 comments on commit 0b387db

Please sign in to comment.