Commit ea51de7
Fix segfault when coverage runs with annotations disabled
The fix in v4.3.0 only avoided negative lineno when BOTH coverage was
running AND annotations were enabled. This still caused segfaults when
coverage was running but annotations were disabled (the common case in
CI environments).
The fix: always use lineno=0 when coverage is running, regardless of
annotation settings. The annotation line stripping is still conditional
on annotations being enabled (since there's nothing to strip otherwise).
Before (v4.3.0):
coverage + annotations → lineno=0 ✓
coverage + no annotations → lineno=-1 → SEGFAULT
After:
coverage + annotations → lineno=0, strip line ✓
coverage + no annotations → lineno=0 ✓
Added regression test for the annotations-disabled case.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 70c6a79 commit ea51de7
3 files changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
213 | 232 | | |
214 | 233 | | |
215 | 234 | | |
| |||
0 commit comments