Xavier de Gaye added the comment:

The proposed patch fixes the problem:
* f_lineno cannot be set now from an exception trace function or from a return
  trace function.
* The broken arithmetic involving a null pointer (f->f_stacktop, at the end of
  frame_setlineno when popping blocks that are being jumped from and the
  function is invoked from an exception trace function or a return trace
  function), is fixed now.
* Blocks cannot be popped now in frame_setlineno (the cause of the crash) when
  tracing a yield.

To summarize the proposed fixes on f_lineno accessors:
* setter: f_lineno can only be set in the frame that is being traced (issue
  17277) and from within a line trace function (current issue).
* getter: f_lineno is valid in the frame being traced (issue 17277) and:
  + not from within a call trace function (i.e. when f->f_trace == NULL)
  + from within a line trace function
  + and from within an exception or return trace function. There is a corner
    case here when returning to a frame that was not being traced previously
    (its f_lineno is not valid) and that has had its local trace function
    f_trace set from within a trace function in one of its callees (the fix of
    issue 13183 does that) and when the first trace function invoked on
    returning to that frame is an exception or a return trace function: this is
    correctly handled by the f_trace setter that makes sure that f_lineno is
    accurate when setting f_trace (and an extension module implementing tracing,
    must ensure that f_lineno is accurate when setting f_trace).

----------
keywords: +patch
Added file: http://bugs.python.org/file29283/default.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17288>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to