bpo-24565: f->f_lineno is now -1 when tracing is not set #12419
Closed
xdegaye wants to merge 5 commits intopython:masterfrom
xdegaye:bpo-24565
Closed
bpo-24565: f->f_lineno is now -1 when tracing is not set #12419xdegaye wants to merge 5 commits intopython:masterfrom xdegaye:bpo-24565
xdegaye wants to merge 5 commits intopython:masterfrom
xdegaye:bpo-24565
Conversation
When tracing is set, f->f_lineno is valid for all the frames of the stack except upon starting or resuming a frame where it is -1 until the first call to maybe_call_line_trace(). Fix issues 7238, 16482, 17277 and 17697.
The coverage.py test suite expects f_lineno to be valid on trace call events.
Contributor
Contributor
|
@xdegaye diff --cc Python/ceval.c
index 9f46b56fdd,3306fb9728..853b8b9881
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@@ -4467,8 -4596,7 +4597,8 @@@ call_trace_protected(Py_tracefunc func
{
PyObject *type, *value, *traceback;
int err;
+ frame->f_lineno = PyFrame_GetLineNumber(frame);
- PyErr_Fetch(&type, &value, &traceback);
+ _PyErr_Fetch(tstate, &type, &value, &traceback);
err = call_trace(func, obj, tstate, frame, what, arg);
if (err == 0)
{
@@@ -4574,7 -4706,10 +4708,11 @@@ PyEval_SetProfile(Py_tracefunc func, Py
void
PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
{
+ if (PySys_Audit("sys.settrace", NULL) < 0) {
+ return;
+ }
+
+ PyFrameObject *f;
_PyRuntimeState *runtime = &_PyRuntime;
PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
PyObject *temp = tstate->c_traceobj; |
Contributor
|
@xdegaye |
Contributor
|
Related: https://www.python.org/dev/peps/pep-0626/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a follow up on PR #6233 that has been closed after becoming
from unknown repository.The
Python/ceval.cconflict in PR #6233 has been resolved andmastermerged into branch[bpo-24565](https://bugs.python.org/issue24565).https://bugs.python.org/issue24565