File tree 1 file changed +12
-10
lines changed
1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -207,35 +207,37 @@ get_events(_Py_Monitors *m, int tool_id)
207
207
* line = first_line + (offset >> OFFSET_SHIFT) + line_delta;
208
208
*/
209
209
210
+ #define NO_LINE -128
211
+ #define COMPUTED_LINE -127
212
+
210
213
#define OFFSET_SHIFT 4
211
214
212
215
static int8_t
213
216
compute_line_delta (PyCodeObject * code , int offset , int line )
214
217
{
215
218
if (line < 0 ) {
216
- return -128 ;
219
+ return NO_LINE ;
217
220
}
218
221
int delta = line - code -> co_firstlineno - (offset >> OFFSET_SHIFT );
219
- if (delta < 128 && delta > -128 ) {
222
+ if (delta <= INT8_MAX && delta > COMPUTED_LINE ) {
220
223
return delta ;
221
224
}
222
- return -127 ;
225
+ return COMPUTED_LINE ;
223
226
}
224
227
225
228
static int
226
229
compute_line (PyCodeObject * code , int offset , int8_t line_delta )
227
230
{
228
- if (line_delta > -127 ) {
231
+ if (line_delta > COMPUTED_LINE ) {
229
232
return code -> co_firstlineno + (offset >> OFFSET_SHIFT ) + line_delta ;
230
233
}
231
- if (line_delta == -128 ) {
234
+ if (line_delta == NO_LINE ) {
235
+
232
236
return -1 ;
233
237
}
234
- else {
235
- assert (line_delta == -127 );
236
- /* Look it up */
237
- return PyCode_Addr2Line (code , offset * sizeof (_Py_CODEUNIT ));
238
- }
238
+ assert (line_delta == COMPUTED_LINE );
239
+ /* Look it up */
240
+ return PyCode_Addr2Line (code , offset * sizeof (_Py_CODEUNIT ));
239
241
}
240
242
241
243
static int
You can’t perform that action at this time.
0 commit comments