Issue20040
Created on 2013年12月21日 13:55 by xdegaye, last changed 2022年04月11日 14:57 by admin.
| Files |
| File name |
Uploaded |
Description |
Edit |
|
tracer.py
|
xdegaye,
2013年12月21日 13:55
|
| Messages (2) |
|
msg206734 - (view) |
Author: Xavier de Gaye (xdegaye) * (Python triager) |
Date: 2013年12月21日 13:55 |
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).
|
|
msg206738 - (view) |
Author: Xavier de Gaye (xdegaye) * (Python triager) |
Date: 2013年12月21日 14:06 |
A patch is proposed in issue 20041.
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2022年04月11日 14:57:55 | admin | set | github: 64239 |
| 2013年12月21日 14:21:32 | vstinner | set | nosy:
+ pitrou, serhiy.storchaka
|
| 2013年12月21日 14:21:22 | vstinner | set | nosy:
+ nedbat
|
| 2013年12月21日 14:06:19 | xdegaye | set | messages:
+ msg206738 |
| 2013年12月21日 13:55:53 | xdegaye | create |