Author xdegaye
Recipients xdegaye
Date 2018-05-08.18:49:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525805395.7.0.682650639539.issue33446@psf.upfronthosting.co.za>
In-reply-to
Content
In both cases the destructor cannot be traced because it is invoked from functions called from [1] call_trace() where tracing is disabled:

  Case local variable 'a':
    On line 12, just before executing this line with a pdb step command, the object referenced by 'a' lives in frame->f_locals. The step command causes the ceval loop to execute the bytecodes corresponding to the statement on line 12 and to eventualy call [2] call_trampoline() with a 'return' trace event and to call PyFrame_FastToLocalsWithError() here. This last call causes the last reference to the previous 'a' object in frame->f_locals to be decremented and the object to be deallocated but without its destructor being traced as tracing has been disabled in call_trace().

  Case local variable 'b':
    Upon exiting the frame of the 'main' function, pdb keeps a reference to frame->f_locals through its own attribute curframe_locals.  Next, after returning to the 'main' caller, this reference is decremented since pdb.curframe_locals references now another object and the dictionary referenced by the previous frame f_locals (the frame of 'main') is deallocated, but this happens within pdb where tracing is disabled and the destructor of the object that had been referenced by 'b' is therefore not traced.

PR 6730 proposes a fix for both cases.

[1] https://github.com/python/cpython/blob/master/Python/ceval.c#L4247
[2] https://github.com/python/cpython/blob/master/Python/sysmodule.c#L462
History
Date User Action Args
2018-05-08 18:49:55xdegayesetrecipients: + xdegaye
2018-05-08 18:49:55xdegayesetmessageid: <1525805395.7.0.682650639539.issue33446@psf.upfronthosting.co.za>
2018-05-08 18:49:55xdegayelinkissue33446 messages
2018-05-08 18:49:55xdegayecreate