Make tracing info (bounds, and previous instruction offset) a bit more robust #24726
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.
Small refactoring to the handling of tracing in
_PyEval_EvalFrameDefault
.This is strictly a refactoring; it does not change behavior in any way.
Currently we rely on
instr_prev
to determine ifbounds
is up to date. Ifinstr_prev < 0
thenbounds
is not up to date.This is undocumented, and thus fragile.
In addition, we have to initialize
bounds
every time, even if we never need it.This PR bundles
instr_prev
andbounds
, along with a pointer to the code object into a new struct.Passing this
trace_info
around instead of thebounds
means that we never pass an inconsistent data structure around.