summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sys.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-05-07 14:19:19 (GMT)
committerGitHub <noreply@github.com>2021-05-07 14:19:19 (GMT)
commitadcd2205565f91c6719f4141ab4e1da6d7086126 (patch)
tree0953b285944eccde57b05b8f3c7e30fb501a3d64 /Lib/test/test_sys.py
parentb32c8e97951db46484ba3b646b988bcdc4062199 (diff)
downloadcpython-adcd2205565f91c6719f4141ab4e1da6d7086126.zip
cpython-adcd2205565f91c6719f4141ab4e1da6d7086126.tar.gz
cpython-adcd2205565f91c6719f4141ab4e1da6d7086126.tar.bz2
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%.
Diffstat (limited to 'Lib/test/test_sys.py')
-rw-r--r--Lib/test/test_sys.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 1fd5247..4f26689 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -1273,13 +1273,12 @@ class SizeofTest(unittest.TestCase):
check(sys.float_info, vsize('') + self.P * len(sys.float_info))
# frame
import inspect
- CO_MAXBLOCKS = 20
x = inspect.currentframe()
ncells = len(x.f_code.co_cellvars)
nfrees = len(x.f_code.co_freevars)
- extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
- ncells + nfrees - 1
- check(x, vsize('4Pi2c4P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
+ localsplus = x.f_code.co_stacksize + x.f_code.co_nlocals +\
+ ncells + nfrees
+ check(x, vsize('8P3i3c' + localsplus*'P'))
# function
def func(): pass
check(func, size('14P'))