mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +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
|
@ -218,7 +218,7 @@ class ExceptionTests(unittest.TestCase):
|
|||
check('class foo:return 1', 1, 11)
|
||||
check('def f():\n continue', 2, 3)
|
||||
check('def f():\n break', 2, 3)
|
||||
check('try:\n pass\nexcept:\n pass\nexcept ValueError:\n pass', 2, 3)
|
||||
check('try:\n pass\nexcept:\n pass\nexcept ValueError:\n pass', 3, 1)
|
||||
|
||||
# Errors thrown by tokenizer.c
|
||||
check('(0x+1)', 1, 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue