New submission from Xavier de Gaye: The sys.settrace documentation states: The trace function is invoked (with event set to 'call') whenever a new local scope is entered; it should return a reference to a local trace function to be used that scope, or None if the scope shouldn’t be traced.
But when tracing a generator, 'line' events may be traced even though tracing has been disabled by returning None at the 'call' event. Run the attached tracer.py with 0 as argument and see that tracing does not stop as it should when count is 1: $ python tracer.py 0 call gen with count 0 line line return call gen with count 1 returning None: the scope shouldn’t be traced line return However, when tracer.py is run with 1 as argument, tracing is (correctly) disabled when count is 1 and 2. This problem is closely related to issue 11992. The dispatch_call() method of Bdb in the bdb module is broken when the frame is a generator and the previous command is next, until or return (and when this problem is fixed). ---------- components: Interpreter Core files: tracer.py messages: 206734 nosy: xdegaye priority: normal severity: normal status: open title: Tracing not disabled in generator when the system trace function returns None. type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33244/tracer.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20040> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com