diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-01-10 09:24:22 (GMT) |
---|---|---|
committer | Mark Shannon <mark@hotpy.org> | 2020-01-10 09:24:22 (GMT) |
commit | 4c53e63cc966f98e141a09bc435b9f9c713b152d (patch) | |
tree | 27435c8386cf6a99db3de9300b15a6ac6f70640d /Python | |
parent | 850a8856e120f8cba15e557a0e791f93b43d6989 (diff) | |
download | cpython-4c53e63cc966f98e141a09bc435b9f9c713b152d.zip cpython-4c53e63cc966f98e141a09bc435b9f9c713b152d.tar.gz cpython-4c53e63cc966f98e141a09bc435b9f9c713b152d.tar.bz2 |
bpo-39166: Fix trace of last iteration of async for loops (#17800)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index bd9454b..3bbd0ca 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3610,11 +3610,15 @@ exception_unwind: PUSH(val); PUSH(exc); JUMPTO(handler); - if (_Py_TracingPossible(ceval) && - ((f->f_lasti < instr_lb || f->f_lasti >= instr_ub) || - !(f->f_lasti == instr_lb || f->f_lasti < instr_prev))) { - /* Make sure that we trace line after exception */ - instr_prev = INT_MAX; + if (_Py_TracingPossible(ceval)) { + int needs_new_execution_window = (f->f_lasti < instr_lb || f->f_lasti >= instr_ub); + int needs_line_update = (f->f_lasti == instr_lb || f->f_lasti < instr_prev); + /* Make sure that we trace line after exception if we are in a new execution + * window or we don't need a line update and we are not in the first instruction + * of the line. */ + if (needs_new_execution_window || (!needs_line_update && instr_lb > 0)) { + instr_prev = INT_MAX; + } } /* Resume normal execution */ goto main_loop; |