summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-05-21 10:57:35 +0100
committerGitHub <noreply@github.com>2021-05-21 10:57:35 +0100
commitb11a951f16f0603d98de24fee5c023df83ea552c (patch)
tree82e7807515db0e284d9ebc3b8c3ba6ff08699ea5 /Lib/test
parentbe4dd7fcd93ed29d362c4bbcc48151bc619d6595 (diff)
downloadcpython-git-b11a951f16f0603d98de24fee5c023df83ea552c.tar.gz
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.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_gdb.py11
-rw-r--r--Lib/test/test_sys.py6
2 files changed, 7 insertions, 10 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 22c75bae98..7bdef25c76 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -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))
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index 4f266894bf..6574c4f9b7 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -1274,11 +1274,7 @@ class SizeofTest(unittest.TestCase):
# frame
import inspect
x = inspect.currentframe()
- ncells = len(x.f_code.co_cellvars)
- nfrees = len(x.f_code.co_freevars)
- localsplus = x.f_code.co_stacksize + x.f_code.co_nlocals +\
- ncells + nfrees
- check(x, vsize('8P3i3c' + localsplus*'P'))
+ check(x, size('5P3i4cP'))
# function
def func(): pass
check(func, size('14P'))