Message11021

Author nedbat
Recipients nedbat
Date 2017-01-14.19:30:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484422214.03.0.358886843677.issue2540@psf.upfronthosting.co.za>
In-reply-to
Content
Similar to #1751, the trace function doesn't report events for "with" statements:

$ cat bug.py
import sys

def tracefunc(frame, event, arg):
    print "Trace", event, frame.f_lineno
    return tracefunc

def do():
    with open("hello.txt", "w") as f:
        f.write("Hello\n")

sys.settrace(tracefunc)
do()

$ python2.7 bug.py
Trace call 7
Trace line 8
Trace line 9
Trace return 9
Trace call 38
Trace call 38

$ jython bug.py
Trace call 7
Trace line 9
Trace return 9
$
History
Date User Action Args
2017-01-14 19:30:14nedbatsetrecipients: + nedbat
2017-01-14 19:30:14nedbatsetmessageid: <1484422214.03.0.358886843677.issue2540@psf.upfronthosting.co.za>
2017-01-14 19:30:13nedbatlinkissue2540 messages
2017-01-14 19:30:13nedbatcreate