mirror of
https://github.com/python/cpython.git
synced 2025-07-22 02:35:22 +00:00
bpo-44032: Move data stack to thread from FrameObject. (GH-26076)
* Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames. * Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells. * Move locals, cells and freevars out of frame object into separate memory buffer. * Use per-threadstate allocated memory chunks for local variables. * Move globals and builtins from frame object to per-thread stack. * Move (slow) locals frame object to per-thread stack. * Move internal frame functions to internal header.
This commit is contained in:
parent
be4dd7fcd9
commit
b11a951f16
20 changed files with 454 additions and 250 deletions
|
@ -666,15 +666,16 @@ id(a)''')
|
|||
|
||||
def test_frames(self):
|
||||
gdb_output = self.get_stack_trace('''
|
||||
import sys
|
||||
def foo(a, b, c):
|
||||
pass
|
||||
return sys._getframe(0)
|
||||
|
||||
foo(3, 4, 5)
|
||||
id(foo.__code__)''',
|
||||
f = foo(3, 4, 5)
|
||||
id(f)''',
|
||||
breakpoint='builtin_id',
|
||||
cmds_after_breakpoint=['print (PyFrameObject*)(((PyCodeObject*)v)->co_zombieframe)']
|
||||
cmds_after_breakpoint=['print (PyFrameObject*)v']
|
||||
)
|
||||
self.assertTrue(re.match(r'.*\s+\$1 =\s+Frame 0x-?[0-9a-f]+, for file <string>, line 3, in foo \(\)\s+.*',
|
||||
self.assertTrue(re.match(r'.*\s+\$1 =\s+Frame 0x-?[0-9a-f]+, for file <string>, line 4, in foo \(a=3.*',
|
||||
gdb_output,
|
||||
re.DOTALL),
|
||||
'Unexpected gdb representation: %r\n%s' % (gdb_output, gdb_output))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue