[ python-Bugs-1583862 ] yield+break stops tracing

SourceForge.net noreply at sourceforge.net
Sat May 19 20:47:21 CEST 2007


Bugs item #1583862, was opened at 2006-10-24 17:55
Message generated for change (Settings changed) made by luks
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1583862&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Lukas Lalinsky (luks)
Assigned to: Nobody/Anonymous (nobody)
Summary: yield+break stops tracing

Initial Comment:
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: <module>
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.


----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2007-04-11 18:52

Message:
Logged In: YES 
user_id=80475
Originator: NO

Using Py2.5.1, the problem seems to have gone away.
Lukas, can you please verify that it is solved and then close.


=======================================================================
rhettinger at localhost ~ $ py25/python -m trace --trace --count test.py
 --- modulename: threading, funcname: settrace
threading.py(70):     _trace_hook = func
 --- modulename: trace, funcname: <module>
<string>(1):   --- modulename: trace, funcname: <module>
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


----------------------------------------------------------------------

Comment By: Lukas Lalinsky (luks)
Date: 2006-10-24 18:05

Message:
Logged In: YES 
user_id=587716

Oh, I forgot. This bug is specific to Python 2.5. It works
fine in 2.4.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1583862&group_id=5470


More information about the Python-bugs-list mailing list