mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	gh-111997: Fix argument count for LINE event and clarify type of argument counts. (#119179)
This commit is contained in:
		
							parent
							
								
									008bc04dcb
								
							
						
					
					
						commit
						70b07aa415
					
				
					 1 changed files with 12 additions and 10 deletions
				
			
		|  | @ -893,7 +893,7 @@ remove_per_instruction_tools(PyCodeObject * code, int offset, int tools) | ||||||
| static int | static int | ||||||
| call_one_instrument( | call_one_instrument( | ||||||
|     PyInterpreterState *interp, PyThreadState *tstate, PyObject **args, |     PyInterpreterState *interp, PyThreadState *tstate, PyObject **args, | ||||||
|     Py_ssize_t nargsf, int8_t tool, int event) |     size_t nargsf, int8_t tool, int event) | ||||||
| { | { | ||||||
|     assert(0 <= tool && tool < 8); |     assert(0 <= tool && tool < 8); | ||||||
|     assert(tstate->tracing == 0); |     assert(tstate->tracing == 0); | ||||||
|  | @ -1084,7 +1084,7 @@ call_instrumentation_vector( | ||||||
|     args[2] = offset_obj; |     args[2] = offset_obj; | ||||||
|     PyInterpreterState *interp = tstate->interp; |     PyInterpreterState *interp = tstate->interp; | ||||||
|     uint8_t tools = get_tools_for_instruction(code, interp, offset, event); |     uint8_t tools = get_tools_for_instruction(code, interp, offset, event); | ||||||
|     Py_ssize_t nargsf = nargs | PY_VECTORCALL_ARGUMENTS_OFFSET; |     size_t nargsf = (size_t) nargs | PY_VECTORCALL_ARGUMENTS_OFFSET; | ||||||
|     PyObject **callargs = &args[1]; |     PyObject **callargs = &args[1]; | ||||||
|     int err = 0; |     int err = 0; | ||||||
|     while (tools) { |     while (tools) { | ||||||
|  | @ -2439,13 +2439,15 @@ capi_call_instrumentation(PyMonitoringState *state, PyObject *codelike, int32_t | ||||||
|         PyErr_SetString(PyExc_ValueError, "offset must be non-negative"); |         PyErr_SetString(PyExc_ValueError, "offset must be non-negative"); | ||||||
|         return -1; |         return -1; | ||||||
|     } |     } | ||||||
|     PyObject *offset_obj = PyLong_FromLong(offset); |     if (event != PY_MONITORING_EVENT_LINE) { | ||||||
|     if (offset_obj == NULL) { |         PyObject *offset_obj = PyLong_FromLong(offset); | ||||||
|         return -1; |         if (offset_obj == NULL) { | ||||||
|  |             return -1; | ||||||
|  |         } | ||||||
|  |         assert(args[2] == NULL); | ||||||
|  |         args[2] = offset_obj; | ||||||
|     } |     } | ||||||
|     assert(args[2] == NULL); |     size_t nargsf = (size_t) nargs | PY_VECTORCALL_ARGUMENTS_OFFSET; | ||||||
|     args[2] = offset_obj; |  | ||||||
|     Py_ssize_t nargsf = nargs | PY_VECTORCALL_ARGUMENTS_OFFSET; |  | ||||||
|     PyObject **callargs = &args[1]; |     PyObject **callargs = &args[1]; | ||||||
|     int err = 0; |     int err = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -2565,8 +2567,8 @@ _PyMonitoring_FireLineEvent(PyMonitoringState *state, PyObject *codelike, int32_ | ||||||
|     if (lno == NULL) { |     if (lno == NULL) { | ||||||
|         return -1; |         return -1; | ||||||
|     } |     } | ||||||
|     PyObject *args[4] = { NULL, NULL, NULL, lno }; |     PyObject *args[3] = { NULL, NULL, lno }; | ||||||
|     int res= capi_call_instrumentation(state, codelike, offset, args, 3, |     int res= capi_call_instrumentation(state, codelike, offset, args, 2, | ||||||
|                                        PY_MONITORING_EVENT_LINE); |                                        PY_MONITORING_EVENT_LINE); | ||||||
|     Py_DECREF(lno); |     Py_DECREF(lno); | ||||||
|     return res; |     return res; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 scoder
						scoder