Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70b07aa

Browse files
authored
gh-111997: Fix argument count for LINE event and clarify type of argument counts. (#119179)
1 parent008bc04 commit70b07aa

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

‎Python/instrumentation.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ remove_per_instruction_tools(PyCodeObject * code, int offset, int tools)
893893
staticint
894894
call_one_instrument(
895895
PyInterpreterState*interp,PyThreadState*tstate,PyObject**args,
896-
Py_ssize_tnargsf,int8_ttool,intevent)
896+
size_tnargsf,int8_ttool,intevent)
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_ttools=get_tools_for_instruction(code,interp,offset,event);
1087-
Py_ssize_tnargsf=nargs |PY_VECTORCALL_ARGUMENTS_OFFSET;
1087+
size_tnargsf= (size_t)nargs |PY_VECTORCALL_ARGUMENTS_OFFSET;
10881088
PyObject**callargs=&args[1];
10891089
interr=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_tnargsf=nargs |PY_VECTORCALL_ARGUMENTS_OFFSET;
2450+
size_tnargsf= (size_t)nargs |PY_VECTORCALL_ARGUMENTS_OFFSET;
24492451
PyObject**callargs=&args[1];
24502452
interr=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-
intres=capi_call_instrumentation(state,codelike,offset,args,3,
2570+
PyObject*args[3]= {NULL,NULL,lno };
2571+
intres=capi_call_instrumentation(state,codelike,offset,args,2,
25702572
PY_MONITORING_EVENT_LINE);
25712573
Py_DECREF(lno);
25722574
returnres;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp