@@ -305,7 +305,7 @@ CTracer_check_missing_return(CTracer *self, PyFrameObject *frame)
305
305
goto error ;
306
306
}
307
307
}
308
- SHOWLOG (self -> pdata_stack -> depth , PyFrame_GetLineNumber (frame ), frame -> f_code -> co_filename , "missedreturn" );
308
+ SHOWLOG (self -> pdata_stack -> depth , PyFrame_GetLineNumber (frame ), MyFrame_GetCode ( frame ) -> co_filename , "missedreturn" );
309
309
self -> pdata_stack -> depth -- ;
310
310
self -> pcur_entry = & self -> pdata_stack -> stack [self -> pdata_stack -> depth ];
311
311
}
@@ -384,7 +384,7 @@ CTracer_handle_call(CTracer *self, PyFrameObject *frame)
384
384
}
385
385
386
386
/* Check if we should trace this line. */
387
- filename = frame -> f_code -> co_filename ;
387
+ filename = MyFrame_GetCode ( frame ) -> co_filename ;
388
388
disposition = PyDict_GetItem (self -> should_trace_cache , filename );
389
389
if (disposition == NULL ) {
390
390
if (PyErr_Occurred ()) {
@@ -549,7 +549,7 @@ CTracer_handle_call(CTracer *self, PyFrameObject *frame)
549
549
* real byte offset for a generator re-entry.
550
550
*/
551
551
if (frame -> f_lasti < 0 ) {
552
- self -> pcur_entry -> last_line = - frame -> f_code -> co_firstlineno ;
552
+ self -> pcur_entry -> last_line = - MyFrame_GetCode ( frame ) -> co_firstlineno ;
553
553
}
554
554
else {
555
555
self -> pcur_entry -> last_line = PyFrame_GetLineNumber (frame );
@@ -633,7 +633,7 @@ CTracer_handle_line(CTracer *self, PyFrameObject *frame)
633
633
634
634
STATS ( self -> stats .lines ++ ; )
635
635
if (self -> pdata_stack -> depth >= 0 ) {
636
- SHOWLOG (self -> pdata_stack -> depth , PyFrame_GetLineNumber (frame ), frame -> f_code -> co_filename , "line" );
636
+ SHOWLOG (self -> pdata_stack -> depth , PyFrame_GetLineNumber (frame ), MyFrame_GetCode ( frame ) -> co_filename , "line" );
637
637
if (self -> pcur_entry -> file_data ) {
638
638
int lineno_from = -1 ;
639
639
int lineno_to = -1 ;
@@ -714,14 +714,14 @@ CTracer_handle_return(CTracer *self, PyFrameObject *frame)
714
714
* f_lasti before reading the byte.
715
715
*/
716
716
int bytecode = RETURN_VALUE ;
717
- PyObject * pCode = frame -> f_code -> co_code ;
717
+ PyObject * pCode = MyFrame_GetCode ( frame ) -> co_code ;
718
718
int lasti = MyFrame_lasti (frame );
719
719
720
720
if (lasti < PyBytes_GET_SIZE (pCode )) {
721
721
bytecode = PyBytes_AS_STRING (pCode )[lasti ];
722
722
}
723
723
if (bytecode != YIELD_VALUE ) {
724
- int first = frame -> f_code -> co_firstlineno ;
724
+ int first = MyFrame_GetCode ( frame ) -> co_firstlineno ;
725
725
if (CTracer_record_pair (self , self -> pcur_entry -> last_line , - first ) < 0 ) {
726
726
goto error ;
727
727
}
@@ -744,7 +744,7 @@ CTracer_handle_return(CTracer *self, PyFrameObject *frame)
744
744
}
745
745
746
746
/* Pop the stack. */
747
- SHOWLOG (self -> pdata_stack -> depth , PyFrame_GetLineNumber (frame ), frame -> f_code -> co_filename , "return" );
747
+ SHOWLOG (self -> pdata_stack -> depth , PyFrame_GetLineNumber (frame ), MyFrame_GetCode ( frame ) -> co_filename , "return" );
748
748
self -> pdata_stack -> depth -- ;
749
749
self -> pcur_entry = & self -> pdata_stack -> stack [self -> pdata_stack -> depth ];
750
750
}
@@ -775,7 +775,7 @@ CTracer_handle_exception(CTracer *self, PyFrameObject *frame)
775
775
*/
776
776
STATS ( self -> stats .exceptions ++ ; )
777
777
self -> last_exc_back = frame -> f_back ;
778
- self -> last_exc_firstlineno = frame -> f_code -> co_firstlineno ;
778
+ self -> last_exc_firstlineno = MyFrame_GetCode ( frame ) -> co_firstlineno ;
779
779
780
780
return RET_OK ;
781
781
}
@@ -806,14 +806,14 @@ CTracer_trace(CTracer *self, PyFrameObject *frame, int what, PyObject *arg_unuse
806
806
807
807
#if WHAT_LOG
808
808
if (what <= (int )(sizeof (what_sym )/sizeof (const char * ))) {
809
- ascii = PyUnicode_AsASCIIString (frame -> f_code -> co_filename );
809
+ ascii = PyUnicode_AsASCIIString (MyFrame_GetCode ( frame ) -> co_filename );
810
810
printf ("trace: %s @ %s %d\n" , what_sym [what ], PyBytes_AS_STRING (ascii ), PyFrame_GetLineNumber (frame ));
811
811
Py_DECREF (ascii );
812
812
}
813
813
#endif
814
814
815
815
#if TRACE_LOG
816
- ascii = PyUnicode_AsASCIIString (frame -> f_code -> co_filename );
816
+ ascii = PyUnicode_AsASCIIString (MyFrame_GetCode ( frame ) -> co_filename );
817
817
if (strstr (PyBytes_AS_STRING (ascii ), start_file ) && PyFrame_GetLineNumber (frame ) == start_line ) {
818
818
logging = TRUE;
819
819
}
@@ -930,7 +930,7 @@ CTracer_call(CTracer *self, PyObject *args, PyObject *kwds)
930
930
}
931
931
932
932
#if WHAT_LOG
933
- ascii = PyUnicode_AsASCIIString (frame -> f_code -> co_filename );
933
+ ascii = PyUnicode_AsASCIIString (MyFrame_GetCode ( frame ) -> co_filename );
934
934
printf ("pytrace: %s @ %s %d\n" , what_sym [what ], PyBytes_AS_STRING (ascii ), PyFrame_GetLineNumber (frame ));
935
935
Py_DECREF (ascii );
936
936
#endif
0 commit comments