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.
This commit is contained in:
Ned Deily 2016-08-17 17:18:33 -04:00
parent 8bcf312d09
commit dc35cda2de
2 changed files with 5 additions and 1 deletions

View File

@ -167,6 +167,10 @@ Tests
- 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
-------

View File

@ -4963,7 +4963,7 @@ assemble(struct compiler *c, int addNone)
/* 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;