This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fabioz
Recipients fabioz
Date 2018-09-25.15:06:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537887980.13.0.545547206417.issue34799@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3/library/sys.html#sys.settrace explicitly states:

The local trace function should return a reference to itself (or to another function for further tracing in that scope), or None to turn off tracing in that scope.

Yet, it seems this happens only on the return of a 'call'. If None is returned in a 'line' event, apparently the previous tracing function is reused (but if a new function is returned, the new function is used properly).

I'm attaching a test case which shows the issue. I've tested on 2.7, 3.6 and 3.7 and this issue is present on all.

If I set frame.f_trace = None before returning it seems to work though (so, I think that either this behavior should be fixed or the docs should be updated to reflect that).
History
Date User Action Args
2018-09-25 15:06:20fabiozsetrecipients: + fabioz
2018-09-25 15:06:20fabiozsetmessageid: <1537887980.13.0.545547206417.issue34799@psf.upfronthosting.co.za>
2018-09-25 15:06:20fabiozlinkissue34799 messages
2018-09-25 15:06:19fabiozcreate