[issue20040] Tracing not disabled in generator when the system trace function returns None.
Xavier de Gaye
report at bugs.python.org
Sat Dec 21 14:55:53 CET 2013
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 <report at bugs.python.org>
<http://bugs.python.org/issue20040>
_______________________________________
More information about the Python-bugs-list
mailing list