mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
bpo-40222: "Zero cost" exception handling (GH-25729)
"Zero cost" exception handling. * Uses a lookup table to determine how to handle exceptions. * Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements. * Reduces the size of the frame object by about 60%.
This commit is contained in:
parent
b32c8e9795
commit
adcd220556
30 changed files with 6614 additions and 5687 deletions
|
|
@ -59,7 +59,12 @@ _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg,
|
|||
"stack_effect: jump must be False, True or None");
|
||||
return -1;
|
||||
}
|
||||
effect = PyCompile_OpcodeStackEffectWithJump(opcode, oparg_int, jump_int);
|
||||
if (IS_ARTIFICIAL(opcode)) {
|
||||
effect = PY_INVALID_STACK_EFFECT;
|
||||
}
|
||||
else {
|
||||
effect = PyCompile_OpcodeStackEffectWithJump(opcode, oparg_int, jump_int);
|
||||
}
|
||||
if (effect == PY_INVALID_STACK_EFFECT) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"invalid opcode or oparg");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue