GH-114695: Add sys._clear_internal_caches (GH-115152)

This commit is contained in:
Brandt Bucher 2024-02-12 01:04:36 -08:00 committed by GitHub
parent 54bde5dcc3
commit 235cacff81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 130 additions and 84 deletions

View file

@ -2370,23 +2370,12 @@ dummy_func(
CHECK_EVAL_BREAKER();
PyCodeObject *code = _PyFrame_GetCode(frame);
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
if (executor->vm_data.valid) {
Py_INCREF(executor);
current_executor = executor;
GOTO_TIER_TWO();
}
else {
/* ENTER_EXECUTOR will be the first code unit of the instruction */
assert(oparg < 256);
code->co_executors->executors[oparg] = NULL;
opcode = this_instr->op.code = executor->vm_data.opcode;
this_instr->op.arg = executor->vm_data.oparg;
oparg = executor->vm_data.oparg;
Py_DECREF(executor);
next_instr = this_instr;
DISPATCH_GOTO();
}
current_executor = code->co_executors->executors[oparg & 255];
assert(current_executor->vm_data.index == INSTR_OFFSET() - 1);
assert(current_executor->vm_data.code == code);
assert(current_executor->vm_data.valid);
Py_INCREF(current_executor);
GOTO_TIER_TWO();
}
replaced op(_POP_JUMP_IF_FALSE, (cond -- )) {