mirror of
https://github.com/python/cpython.git
synced 2025-09-12 11:46:52 +00:00
GH-113595: Don't enter invalid executor (GH-113596)
This commit is contained in:
parent
5dc79e3d7f
commit
dc8df6e840
2 changed files with 39 additions and 19 deletions
|
@ -2364,17 +2364,27 @@ dummy_func(
|
||||||
|
|
||||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||||
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
|
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
|
||||||
Py_INCREF(executor);
|
if (executor->vm_data.valid) {
|
||||||
if (executor->execute == _PyUOpExecute) {
|
Py_INCREF(executor);
|
||||||
current_executor = (_PyUOpExecutorObject *)executor;
|
if (executor->execute == _PyUOpExecute) {
|
||||||
GOTO_TIER_TWO();
|
current_executor = (_PyUOpExecutorObject *)executor;
|
||||||
|
GOTO_TIER_TWO();
|
||||||
|
}
|
||||||
|
next_instr = executor->execute(executor, frame, stack_pointer);
|
||||||
|
frame = tstate->current_frame;
|
||||||
|
if (next_instr == NULL) {
|
||||||
|
goto resume_with_error;
|
||||||
|
}
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
next_instr = executor->execute(executor, frame, stack_pointer);
|
else {
|
||||||
frame = tstate->current_frame;
|
opcode = this_instr->op.code = executor->vm_data.opcode;
|
||||||
if (next_instr == NULL) {
|
this_instr->op.arg = executor->vm_data.oparg;
|
||||||
goto resume_with_error;
|
oparg = (oparg & (~255)) | executor->vm_data.oparg;
|
||||||
|
code->co_executors->executors[oparg&255] = NULL;
|
||||||
|
Py_DECREF(executor);
|
||||||
|
DISPATCH_GOTO();
|
||||||
}
|
}
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
replaced op(_POP_JUMP_IF_FALSE, (cond -- )) {
|
replaced op(_POP_JUMP_IF_FALSE, (cond -- )) {
|
||||||
|
|
30
Python/generated_cases.c.h
generated
30
Python/generated_cases.c.h
generated
|
@ -2371,24 +2371,34 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(ENTER_EXECUTOR) {
|
TARGET(ENTER_EXECUTOR) {
|
||||||
frame->instr_ptr = next_instr;
|
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||||
next_instr += 1;
|
next_instr += 1;
|
||||||
INSTRUCTION_STATS(ENTER_EXECUTOR);
|
INSTRUCTION_STATS(ENTER_EXECUTOR);
|
||||||
TIER_ONE_ONLY
|
TIER_ONE_ONLY
|
||||||
CHECK_EVAL_BREAKER();
|
CHECK_EVAL_BREAKER();
|
||||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||||
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
|
_PyExecutorObject *executor = (_PyExecutorObject *)code->co_executors->executors[oparg&255];
|
||||||
Py_INCREF(executor);
|
if (executor->vm_data.valid) {
|
||||||
if (executor->execute == _PyUOpExecute) {
|
Py_INCREF(executor);
|
||||||
current_executor = (_PyUOpExecutorObject *)executor;
|
if (executor->execute == _PyUOpExecute) {
|
||||||
GOTO_TIER_TWO();
|
current_executor = (_PyUOpExecutorObject *)executor;
|
||||||
|
GOTO_TIER_TWO();
|
||||||
|
}
|
||||||
|
next_instr = executor->execute(executor, frame, stack_pointer);
|
||||||
|
frame = tstate->current_frame;
|
||||||
|
if (next_instr == NULL) {
|
||||||
|
goto resume_with_error;
|
||||||
|
}
|
||||||
|
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||||
}
|
}
|
||||||
next_instr = executor->execute(executor, frame, stack_pointer);
|
else {
|
||||||
frame = tstate->current_frame;
|
opcode = this_instr->op.code = executor->vm_data.opcode;
|
||||||
if (next_instr == NULL) {
|
this_instr->op.arg = executor->vm_data.oparg;
|
||||||
goto resume_with_error;
|
oparg = (oparg & (~255)) | executor->vm_data.oparg;
|
||||||
|
code->co_executors->executors[oparg&255] = NULL;
|
||||||
|
Py_DECREF(executor);
|
||||||
|
DISPATCH_GOTO();
|
||||||
}
|
}
|
||||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue