Issue 1583862: yield+break stops tracing (original) (raw)
Issue1583862
Created on 2006-10-24 15:55 by luks, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg30381 - (view) | Author: Lukas Lalinsky (luks) | Date: 2006-10-24 15:55 |
Here is an example script: def myiter(): for i in range(10): yield i for i in myiter(): break print "foo" Now, if I try to trace it: $ python -m trace --trace --count test.py --- modulename: threading, funcname: settrace threading.py(70): _trace_hook = func --- modulename: test, funcname: test.py(1): def myiter(): test.py(5): for i in myiter(): --- modulename: test, funcname: myiter test.py(2): for i in range(10): test.py(3): yield i test.py(6): break c:\python25\lib\ntpath.py:190: RuntimeWarning: tp_compare didn't return -1 or -2 for exception if i<=max(p.rfind('/'), p.rfind('\\')): foo It stops tracing after the `break` statement. The line after, `print "foo"`, is not traced nor included in the coverage output. I'm not sure RuntimeWarning from ntpath.py is relevant here, because if I use the trace module in some other situation it doesn't print it. IMO, it's just a side effect of some different problem. | ||
msg30382 - (view) | Author: Lukas Lalinsky (luks) | Date: 2006-10-24 16:05 |
Logged In: YES user_id=587716 Oh, I forgot. This bug is specific to Python 2.5. It works fine in 2.4. | ||
msg30383 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2007-04-11 16:52 |
Using Py2.5.1, the problem seems to have gone away. Lukas, can you please verify that it is solved and then close. ======================================================================= rhettinger@localhost ~ $ py25/python -m trace --trace --count test.py --- modulename: threading, funcname: settrace threading.py(70): _trace_hook = func --- modulename: trace, funcname: (1): --- modulename: trace, funcname: test.py(1): def myiter(): test.py(6): for i in myiter(): --- modulename: trace, funcname: myiter test.py(2): for i in range(10): test.py(3): yield i test.py(7): break --- modulename: trace, funcname: myiter test.py(9): print 'foo' foo |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:20 | admin | set | github: 44162 |
2006-10-24 15:55:56 | luks | create |