summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2016-08-17 21:18:33 (GMT)
committerNed Deily <nad@python.org>2016-08-17 21:18:33 (GMT)
commitdc35cda2de9888f78218fd5207f516ceec0d4e82 (patch)
tree898b92fea71bff8b525051c94fbbb3eea4e294c0 /Python
parent8bcf312d093cd90ca65b329d3f97ec2a1304c5b3 (diff)
downloadcpython-dc35cda2de9888f78218fd5207f516ceec0d4e82.zip
cpython-dc35cda2de9888f78218fd5207f516ceec0d4e82.tar.gz
cpython-dc35cda2de9888f78218fd5207f516ceec0d4e82.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index e46676c..fb80f51 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;