mirror of
https://github.com/python/cpython.git
synced 2026-05-09 06:01:08 -04:00
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:
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user