Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

#17288: cannot jump from a return after setting f_lineno

Can't Edit
Can't Publish+Mail
Start Review
Created:
5 years, 7 months ago by xdegaye
Modified:
7 months, 3 weeks ago
Reviewers:
storchaka+cpython
CC:
Georg, jcea, haypo, Benjamin Peterson, xdegaye, storchaka, mariatta.wijaya+miss-islington_gmail.com
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/test/test_sys_settrace.py View 1 4 chunks +42 lines, -6 lines 0 comments Download
Objects/frameobject.c View 1 2 chunks +21 lines, -1 line 2 comments Download

Messages

Total messages: 2
storchaka
https://bugs.python.org/review/17288/diff/12360/Objects/frameobject.c File Objects/frameobject.c (right): https://bugs.python.org/review/17288/diff/12360/Objects/frameobject.c#newcode105 Objects/frameobject.c:105: switch (code[f->f_lasti]) { Couldn't f->f_lasti be -1?
7 months, 4 weeks ago #1
xdegaye
7 months, 3 weeks ago #2
https://bugs.python.org/review/17288/diff/12360/Objects/frameobject.c
File Objects/frameobject.c (right):

https://bugs.python.org/review/17288/diff/12360/Objects/frameobject.c#newcode105
Objects/frameobject.c:105: switch (code[f->f_lasti]) {
On 2018/02/26 19:51:04, storchaka wrote:
> Couldn't f->f_lasti be -1?

No.
The trace function is called with 'f->f_lasti == -1' at the start of
_PyEval_EvalFrameDefault() by call_trace_protected(..., PyTrace_CALL, ...) when
f->f_trace is NULL, frame_setlineno() returns -1 in that case.

I will clarify in the PR that, as a side effect of allowing to set f_lineno only
from trace functions where  f->f_trace is not NULL, jumps are forbidden also
from 'call' trace events. This is the current behavior, not something that is
introduced by the PR. I will also add an assert.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7