File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Original file line number Diff line number Diff line change @@ -685,7 +685,8 @@ CTracer_handle_line(CTracer *self, PyFrameObject *frame)
685
685
STATS ( self -> stats .pycalls ++ ; )
686
686
from_to = PyObject_CallMethodObjArgs (self -> pcur_entry -> file_tracer , str_line_number_range , frame , NULL );
687
687
if (from_to == NULL ) {
688
- goto error ;
688
+ CTracer_disable_plugin (self , self -> pcur_entry -> disposition );
689
+ goto ok ;
689
690
}
690
691
ret2 = CTracer_unpack_pair (self , from_to , & lineno_from , & lineno_to );
691
692
Py_DECREF (from_to );
Original file line number Diff line number Diff line change @@ -804,6 +804,28 @@ def coverage_init(reg, options):
804
804
""" )
805
805
self .run_bad_plugin ("bad_plugin" , "Plugin" )
806
806
807
+ def test_line_number_range_raises_error (self ):
808
+ self .make_file ("bad_plugin.py" , """\
809
+ import coverage.plugin
810
+ class Plugin(coverage.plugin.CoveragePlugin):
811
+ def file_tracer(self, filename):
812
+ if filename.endswith("other.py"):
813
+ return BadFileTracer()
814
+
815
+ class BadFileTracer(coverage.plugin.FileTracer):
816
+ def source_filename(self):
817
+ return "something.foo"
818
+
819
+ def line_number_range(self, frame):
820
+ raise Exception("borked!")
821
+
822
+ def coverage_init(reg, options):
823
+ reg.add_file_tracer(Plugin())
824
+ """ )
825
+ self .run_bad_plugin (
826
+ "bad_plugin" , "Plugin" , our_error = False , excmsg = "borked!" ,
827
+ )
828
+
807
829
def test_line_number_range_returns_non_tuple (self ):
808
830
self .make_file ("bad_plugin.py" , """\
809
831
import coverage.plugin
You can’t perform that action at this time.
0 commit comments