@@ -893,7 +893,7 @@ remove_per_instruction_tools(PyCodeObject * code, int offset, int tools)
893893static int
894894call_one_instrument (
895895 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 )
897897{
898898 assert (0 <= tool && tool < 8 );
899899 assert (tstate -> tracing == 0 );
@@ -1084,7 +1084,7 @@ call_instrumentation_vector(
10841084 args [2 ] = offset_obj ;
10851085 PyInterpreterState * interp = tstate -> interp ;
10861086 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 ;
10881088 PyObject * * callargs = & args [1 ];
10891089 int err = 0 ;
10901090 while (tools ) {
@@ -2439,13 +2439,15 @@ capi_call_instrumentation(PyMonitoringState *state, PyObject *codelike, int32_t
24392439 PyErr_SetString (PyExc_ValueError , "offset must be non-negative" );
24402440 return -1 ;
24412441 }
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 ;
24452449 }
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 ;
24492451 PyObject * * callargs = & args [1 ];
24502452 int err = 0 ;
24512453
@@ -2565,8 +2567,8 @@ _PyMonitoring_FireLineEvent(PyMonitoringState *state, PyObject *codelike, int32_
25652567 if (lno == NULL ) {
25662568 return -1 ;
25672569 }
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 ,
25702572 PY_MONITORING_EVENT_LINE );
25712573 Py_DECREF (lno );
25722574 return res ;
0 commit comments