@@ -893,7 +893,7 @@ remove_per_instruction_tools(PyCodeObject * code, int offset, int tools)
893
893
static int
894
894
call_one_instrument (
895
895
PyInterpreterState * interp , PyThreadState * tstate , PyObject * * args ,
896
- Py_ssize_t nargsf , int8_t tool , int event )
896
+ size_t nargsf , int8_t tool , int event )
897
897
{
898
898
assert (0 <= tool && tool < 8 );
899
899
assert (tstate -> tracing == 0 );
@@ -1084,7 +1084,7 @@ call_instrumentation_vector(
1084
1084
args [2 ] = offset_obj ;
1085
1085
PyInterpreterState * interp = tstate -> interp ;
1086
1086
uint8_t tools = get_tools_for_instruction (code , interp , offset , event );
1087
- Py_ssize_t nargsf = nargs | PY_VECTORCALL_ARGUMENTS_OFFSET ;
1087
+ size_t nargsf = ( size_t ) nargs | PY_VECTORCALL_ARGUMENTS_OFFSET ;
1088
1088
PyObject * * callargs = & args [1 ];
1089
1089
int err = 0 ;
1090
1090
while (tools ) {
@@ -2439,13 +2439,15 @@ capi_call_instrumentation(PyMonitoringState *state, PyObject *codelike, int32_t
2439
2439
PyErr_SetString (PyExc_ValueError , "offset must be non-negative" );
2440
2440
return -1 ;
2441
2441
}
2442
- PyObject * offset_obj = PyLong_FromLong (offset );
2443
- if (offset_obj == NULL ) {
2444
- return -1 ;
2442
+ if (event != PY_MONITORING_EVENT_LINE ) {
2443
+ PyObject * offset_obj = PyLong_FromLong (offset );
2444
+ if (offset_obj == NULL ) {
2445
+ return -1 ;
2446
+ }
2447
+ assert (args [2 ] == NULL );
2448
+ args [2 ] = offset_obj ;
2445
2449
}
2446
- assert (args [2 ] == NULL );
2447
- args [2 ] = offset_obj ;
2448
- Py_ssize_t nargsf = nargs | PY_VECTORCALL_ARGUMENTS_OFFSET ;
2450
+ size_t nargsf = (size_t ) nargs | PY_VECTORCALL_ARGUMENTS_OFFSET ;
2449
2451
PyObject * * callargs = & args [1 ];
2450
2452
int err = 0 ;
2451
2453
@@ -2565,8 +2567,8 @@ _PyMonitoring_FireLineEvent(PyMonitoringState *state, PyObject *codelike, int32_
2565
2567
if (lno == NULL ) {
2566
2568
return -1 ;
2567
2569
}
2568
- PyObject * args [4 ] = { NULL , NULL , NULL , lno };
2569
- int res = capi_call_instrumentation (state , codelike , offset , args , 3 ,
2570
+ PyObject * args [3 ] = { NULL , NULL , lno };
2571
+ int res = capi_call_instrumentation (state , codelike , offset , args , 2 ,
2570
2572
PY_MONITORING_EVENT_LINE );
2571
2573
Py_DECREF (lno );
2572
2574
return res ;
0 commit comments