13
13
static int
14
14
pyint_as_int (PyObject * pyint , int * pint )
15
15
{
16
- int the_int = MyInt_AsInt (pyint );
16
+ int the_int = ( int ) PyLong_AsLong (pyint );
17
17
if (the_int == -1 && PyErr_Occurred ()) {
18
18
return RET_ERROR ;
19
19
}
@@ -39,7 +39,7 @@ CTracer_intern_strings(void)
39
39
int ret = RET_ERROR ;
40
40
41
41
#define INTERN_STRING (v , s ) \
42
- v = MyText_InternFromString (s); \
42
+ v = PyUnicode_InternFromString (s); \
43
43
if (v == NULL) { \
44
44
goto error; \
45
45
}
@@ -149,7 +149,7 @@ showlog(int depth, int lineno, PyObject * filename, const char * msg)
149
149
}
150
150
if (filename ) {
151
151
PyObject * ascii = MyText_AS_BYTES (filename );
152
- printf (" %s" , MyBytes_AS_STRING (ascii ));
152
+ printf (" %s" , PyBytes_AS_STRING (ascii ));
153
153
Py_DECREF (ascii );
154
154
}
155
155
if (msg ) {
@@ -232,7 +232,7 @@ CTracer_set_pdata_stack(CTracer *self)
232
232
233
233
/* A new concurrency object. Make a new data stack. */
234
234
the_index = self -> data_stacks_used ;
235
- stack_index = MyInt_FromInt ( the_index );
235
+ stack_index = PyLong_FromLong (( long ) the_index );
236
236
if (stack_index == NULL ) {
237
237
goto error ;
238
238
}
@@ -542,7 +542,7 @@ CTracer_handle_call(CTracer *self, PyFrameObject *frame)
542
542
543
543
/* Make the frame right in case settrace(gettrace()) happens. */
544
544
Py_INCREF (self );
545
- My_XSETREF (frame -> f_trace , (PyObject * )self );
545
+ Py_XSETREF (frame -> f_trace , (PyObject * )self );
546
546
547
547
/* A call event is really a "start frame" event, and can happen for
548
548
* re-entering a generator also. f_lasti is -1 for a true call, and a
@@ -668,7 +668,7 @@ CTracer_handle_line(CTracer *self, PyFrameObject *frame)
668
668
}
669
669
else {
670
670
/* Tracing lines: key is simply this_line. */
671
- PyObject * this_line = MyInt_FromInt ( lineno_from );
671
+ PyObject * this_line = PyLong_FromLong (( long ) lineno_from );
672
672
if (this_line == NULL ) {
673
673
goto error ;
674
674
}
@@ -717,8 +717,8 @@ CTracer_handle_return(CTracer *self, PyFrameObject *frame)
717
717
PyObject * pCode = frame -> f_code -> co_code ;
718
718
int lasti = MyFrame_lasti (frame );
719
719
720
- if (lasti < MyBytes_GET_SIZE (pCode )) {
721
- bytecode = MyBytes_AS_STRING (pCode )[lasti ];
720
+ if (lasti < PyBytes_GET_SIZE (pCode )) {
721
+ bytecode = PyBytes_AS_STRING (pCode )[lasti ];
722
722
}
723
723
if (bytecode != YIELD_VALUE ) {
724
724
int first = frame -> f_code -> co_firstlineno ;
@@ -806,15 +806,15 @@ 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 = MyText_AS_BYTES (frame -> f_code -> co_filename );
810
- printf ("trace: %s @ %s %d\n" , what_sym [what ], MyBytes_AS_STRING (ascii ), PyFrame_GetLineNumber (frame ));
809
+ ascii = PyUnicode_AsASCIIString (frame -> f_code -> co_filename );
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 = MyText_AS_BYTES (frame -> f_code -> co_filename );
817
- if (strstr (MyBytes_AS_STRING (ascii ), start_file ) && PyFrame_GetLineNumber (frame ) == start_line ) {
816
+ ascii = PyUnicode_AsASCIIString (frame -> f_code -> co_filename );
817
+ if (strstr (PyBytes_AS_STRING (ascii ), start_file ) && PyFrame_GetLineNumber (frame ) == start_line ) {
818
818
logging = TRUE;
819
819
}
820
820
Py_DECREF (ascii );
@@ -913,25 +913,25 @@ CTracer_call(CTracer *self, PyObject *args, PyObject *kwds)
913
913
static char * kwlist [] = {"frame" , "event" , "arg" , "lineno" , NULL };
914
914
915
915
if (!PyArg_ParseTupleAndKeywords (args , kwds , "O!O!O|i:Tracer_call" , kwlist ,
916
- & PyFrame_Type , & frame , & MyText_Type , & what_str , & arg , & lineno )) {
916
+ & PyFrame_Type , & frame , & PyUnicode_Type , & what_str , & arg , & lineno )) {
917
917
goto done ;
918
918
}
919
919
920
920
/* In Python, the what argument is a string, we need to find an int
921
921
for the C function. */
922
922
for (what = 0 ; what_names [what ]; what ++ ) {
923
923
int should_break ;
924
- ascii = MyText_AS_BYTES (what_str );
925
- should_break = !strcmp (MyBytes_AS_STRING (ascii ), what_names [what ]);
924
+ ascii = PyUnicode_AsASCIIString (what_str );
925
+ should_break = !strcmp (PyBytes_AS_STRING (ascii ), what_names [what ]);
926
926
Py_DECREF (ascii );
927
927
if (should_break ) {
928
928
break ;
929
929
}
930
930
}
931
931
932
932
#if WHAT_LOG
933
- ascii = MyText_AS_BYTES (frame -> f_code -> co_filename );
934
- printf ("pytrace: %s @ %s %d\n" , what_sym [what ], MyBytes_AS_STRING (ascii ), PyFrame_GetLineNumber (frame ));
933
+ ascii = PyUnicode_AsASCIIString (frame -> f_code -> co_filename );
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
937
937
@@ -1108,7 +1108,7 @@ CTracer_methods[] = {
1108
1108
1109
1109
PyTypeObject
1110
1110
CTracerType = {
1111
- MyType_HEAD_INIT
1111
+ PyVarObject_HEAD_INIT ( NULL , 0 )
1112
1112
"coverage.CTracer" , /*tp_name*/
1113
1113
sizeof (CTracer ), /*tp_basicsize*/
1114
1114
0 , /*tp_itemsize*/
0 commit comments