changeset: 102737:1bf307f42a6b user: Ned Deily date: Wed Aug 17 17:18:33 2016 -0400 files: Misc/NEWS Python/compile.c description: Issue #27594: Prevent assertion error when running test_ast with coverage enabled: ensure code object has a valid first line number. Patch suggested by Ivan Levkivskyi. diff -r be9dc240bf28 -r 1bf307f42a6b Misc/NEWS --- a/Misc/NEWS Wed Aug 17 19:48:33 2016 +0200 +++ b/Misc/NEWS Wed Aug 17 17:18:33 2016 -0400 @@ -167,6 +167,10 @@ - Issue #27369: In test_pyexpat, avoid testing an error message detail that changed in Expat 2.2.0. +- Issue #27594: Prevent assertion error when running test_ast with coverage + enabled: ensure code object has a valid first line number. + Patch suggested by Ivan Levkivskyi. + Windows ------- diff -r be9dc240bf28 -r 1bf307f42a6b Python/compile.c --- a/Python/compile.c Wed Aug 17 19:48:33 2016 +0200 +++ b/Python/compile.c Wed Aug 17 17:18:33 2016 -0400 @@ -4963,7 +4963,7 @@ /* Set firstlineno if it wasn't explicitly set. */ if (!c->u->u_firstlineno) { - if (entryblock && entryblock->b_instr) + if (entryblock && entryblock->b_instr && entryblock->b_instr->i_lineno) c->u->u_firstlineno = entryblock->b_instr->i_lineno; else c->u->u_firstlineno = 1;