@@ -295,48 +295,6 @@ CTracer_set_pdata_stack(CTracer *self)
295295 * Parts of the trace function.
296296 */
297297
298- static int
299- CTracer_check_missing_return (CTracer * self , PyFrameObject * frame )
300- {
301- int ret = RET_ERROR ;
302-
303- if (self -> last_exc_back ) {
304- if (frame == self -> last_exc_back ) {
305- /* Looks like someone forgot to send a return event. We'll clear
306- the exception state and do the RETURN code here. Notice that the
307- frame we have in hand here is not the correct frame for the RETURN,
308- that frame is gone. Our handling for RETURN doesn't need the
309- actual frame, but we do log it, so that will look a little off if
310- you're looking at the detailed log.
311-
312- If someday we need to examine the frame when doing RETURN, then
313- we'll need to keep more of the missed frame's state.
314- */
315- STATS ( self -> stats .missed_returns ++ ; )
316- if (CTracer_set_pdata_stack (self ) < 0 ) {
317- goto error ;
318- }
319- if (self -> pdata_stack -> depth >= 0 ) {
320- if (self -> tracing_arcs && self -> pcur_entry -> file_data ) {
321- if (CTracer_record_pair (self , self -> pcur_entry -> last_line , - self -> last_exc_firstlineno ) < 0 ) {
322- goto error ;
323- }
324- }
325- SHOWLOG (PyFrame_GetLineNumber (frame ), MyFrame_GetCode (frame )-> co_filename , "missedreturn" );
326- self -> pdata_stack -> depth -- ;
327- self -> pcur_entry = & self -> pdata_stack -> stack [self -> pdata_stack -> depth ];
328- }
329- }
330- self -> last_exc_back = NULL ;
331- }
332-
333- ret = RET_OK ;
334-
335- error :
336-
337- return ret ;
338- }
339-
340298static int
341299CTracer_handle_call (CTracer * self , PyFrameObject * frame )
342300{
@@ -773,30 +731,6 @@ CTracer_handle_return(CTracer *self, PyFrameObject *frame)
773731 return ret ;
774732}
775733
776- static int
777- CTracer_handle_exception (CTracer * self , PyFrameObject * frame )
778- {
779- /* Some code (Python 2.3, and pyexpat anywhere) fires an exception event
780- without a return event. To detect that, we'll keep a copy of the
781- parent frame for an exception event. If the next event is in that
782- frame, then we must have returned without a return event. We can
783- synthesize the missing event then.
784-
785- Python itself fixed this problem in 2.4. Pyexpat still has the bug.
786- I've reported the problem with pyexpat as http://bugs.python.org/issue6359 .
787- If it gets fixed, this code should still work properly. Maybe some day
788- the bug will be fixed everywhere coverage.py is supported, and we can
789- remove this missing-return detection.
790-
791- More about this fix: https://nedbatchelder.com/blog/200907/a_nasty_little_bug.html
792- */
793- STATS ( self -> stats .exceptions ++ ; )
794- self -> last_exc_back = frame -> f_back ;
795- self -> last_exc_firstlineno = MyFrame_GetCode (frame )-> co_firstlineno ;
796-
797- return RET_OK ;
798- }
799-
800734/*
801735 * The Trace Function
802736 */
@@ -837,11 +771,6 @@ CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unuse
837771 Py_DECREF (ascii );
838772 #endif
839773
840- /* See below for details on missing-return detection. */
841- if (CTracer_check_missing_return (self , frame ) < 0 ) {
842- goto error ;
843- }
844-
845774 self -> activity = TRUE;
846775
847776 switch (what ) {
@@ -863,12 +792,6 @@ CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unuse
863792 }
864793 break ;
865794
866- case PyTrace_EXCEPTION :
867- if (CTracer_handle_exception (self , frame ) < 0 ) {
868- goto error ;
869- }
870- break ;
871-
872795 default :
873796 STATS ( self -> stats .others ++ ; )
874797 break ;
@@ -1050,10 +973,8 @@ CTracer_get_stats(CTracer *self, PyObject *args_unused)
1050973 "calls" , self -> stats .calls ,
1051974 "lines" , self -> stats .lines ,
1052975 "returns" , self -> stats .returns ,
1053- "exceptions" , self -> stats .exceptions ,
1054976 "others" , self -> stats .others ,
1055977 "files" , self -> stats .files ,
1056- "missed_returns" , self -> stats .missed_returns ,
1057978 "stack_reallocs" , self -> stats .stack_reallocs ,
1058979 "stack_alloc" , self -> pdata_stack -> alloc ,
1059980 "errors" , self -> stats .errors ,
0 commit comments