chore(ci_visibility): fix line numbers in Python 3.10 bytecode [backport #10454 to 2.12] #10528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 4bd2998 from #10454 to 2.12.
The line number information in Python 3.10 bytecode is encoded using pairs of (offset_delta, line_number_delta) bytes (more info here). When the line number delta exceeds the limits of a signed byte, this is encoded by using an offset_delta of 0, which was not handled correctly by our instrumentation. This PR fixes that.
This solves an issue where two consecutive opcode instructions with a line gap greater than 127 would be assigned incorrect line numbers, which was triggering an error in dogweb CI.
Testing strategy
This PR was tested in two ways:
dis.dis()
on the bytecode of the offending function in dogweb (1) before instrumentation, (2) after instrumentation before this fix, and (3) after instrumentation with this fix. After the fix, the line numbers for (1) and (3) match, whereas those for (2) don't.Checklist
Reviewer Checklist