New GitHub issue #111081 from nedbat:<br>
<hr>
<pre>
# Bug report
### Bug description:
I am stuck, and could use some help. This could be a coverage.py bug, or a CPython bug. Using Python 3.13, I am getting incorrect data from `co_firstlineno`, but I don't know if there's a CPython bug, or if I am doing something wrong.
To reproduce:
```bash
git clone https://github.com/nedbat/coveragepy
cd coveragepy
git checkout 5915e043e9bc911641eecbe13624f08af1f68ae7
pip install tox
COVERAGE_DEBUG=dataop,dataop2 COVERAGE_DEBUG_FILE=/tmp/debug.out tox -e py313 -- -n 0 -k test_report_skip_covered_branches_with_totals
```
When I run this, my debug.out looks like this (tmp filenames shortened):
```
Setting coverage context: None
Adding arcs: 3 files, 14 arcs total
/tmp/t0/also_not_run.py: [(-1, 2), (2, -1)]
/tmp/t0/main.py: [(-1, 2), (2, -1343), (-5, 6), (6, 7), (7, -5), (6, -5)]
/tmp/t0/not_covered.py: [(-1, 2), (2, 5), (3, 4), (-2, 3), (4, -2), (5, -1)]
Adding file tracers: 0 files
```
"Arcs" are (from, to) pairs of line numbers that execution traversed. A negative "from" number like in (-5, 6) means execution entered the code object that starts at line 5, and started at line 6. A negative "to" number line in (6, -5) means that exection jumped from line 6 to exit the code object that starts at line 5.
The debug output shows that we tried to add pair (2, -1343) for main.py. This means we think execution jumped from line 2 to exit from the code object that starts at line 1343. Except main.py is only 9 lines long (https://github.com/nedbat/coveragepy/blob/5915e043e9bc911641eecbe13624f08af1f68ae7/tests/test_report.py#L417-L437), so something is wrong.
The problem isn't particular to this one test, I've just selected one to provide a focused example.
### CPython versions tested on:
CPython main branch
### Operating systems tested on:
macOS
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/111081">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>