New submission from Fabio Zadrozny <fab...@users.sourceforge.net>:
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). ---------- files: issue_in_tracing_func.py messages: 326360 nosy: fabioz priority: normal severity: normal status: open title: When function in tracing returns None, tracing continues. type: behavior versions: Python 2.7, Python 3.6, Python 3.7 Added file: https://bugs.python.org/file47822/issue_in_tracing_func.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34799> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com