Issue1751

classification
Title: sys.settrace does not consider "try", "except" or "break" statements
Type: Severity: normal
Components: Versions: Jython 2.5
process
Status: open Resolution: remind
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, geoffbache, zyasoft
Priority: normal Keywords:

Created on 2011-05-30.18:52:20 by geoffbache, last changed 2014-07-01.04:09:32 by zyasoft.

Messages
msg6532 (view) Author: Geoff Bache (geoffbache) Date: 2011-05-30.18:52:19
I've been trying to measure coverage of my Jython program and finding
that (at least) all lines containing "try:", "except:" or "break"
never get shown as covered.

This appears to be because the sys.settrace function, on which
coverage.py relies for its information, is not triggered by such
lines. 

For example, compare the output of the following program under Jython
and CPython. No output is created for lines 10, 12 or 13 when running
under Jython, whereas it is for CPython.

import sys

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

def do():
   x = [ 1 ]
   for i in range(2):
       try:
           x[i]
       except IndexError:
           break

sys.settrace(tracefunc)
do()
History
Date User Action Args
2014-07-01 04:09:32zyasoftsetnosy: + zyasoft
2013-02-20 00:10:19fwierzbickisetnosy: + fwierzbicki
2013-02-20 00:10:12fwierzbickisetpriority: normal
resolution: remind
versions: + Jython 2.5, - 2.5.2rc
2011-05-30 18:52:20geoffbachecreate