mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-40941: Unify implicit and explicit state in the frame and generator objects into a single value. (GH-20803)
* Merge gen and frame state variables into one. * Replace stack pointer with depth in PyFrameObject. Makes code easier to read and saves a word of memory.
This commit is contained in:
parent
8e836bb21c
commit
cb9879b948
9 changed files with 155 additions and 95 deletions
|
|
@ -1236,7 +1236,7 @@ class SizeofTest(unittest.TestCase):
|
|||
nfrees = len(x.f_code.co_freevars)
|
||||
extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\
|
||||
ncells + nfrees - 1
|
||||
check(x, vsize('5P2c4P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
|
||||
check(x, vsize('4Pi2c4P3ic' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P'))
|
||||
# function
|
||||
def func(): pass
|
||||
check(func, size('13P'))
|
||||
|
|
@ -1253,7 +1253,7 @@ class SizeofTest(unittest.TestCase):
|
|||
check(bar, size('PP'))
|
||||
# generator
|
||||
def get_gen(): yield 1
|
||||
check(get_gen(), size('Pb2PPP4P'))
|
||||
check(get_gen(), size('P2PPP4P'))
|
||||
# iterator
|
||||
check(iter('abc'), size('lP'))
|
||||
# callable-iterator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue