diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-12-19 12:47:10 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-12-19 12:47:10 (GMT) |
commit | d974393419eb55ad7f483ff3c56f746446778172 (patch) | |
tree | b9b30f46130ef790563fac7da4e169860b442b01 /Lib/test | |
parent | 6db4944cc57804391b554d96f3400944779617f0 (diff) | |
parent | d208416a4033c1d8e10ee70e1aa74e6d3108c7d6 (diff) | |
download | cpython-d974393419eb55ad7f483ff3c56f746446778172.zip cpython-d974393419eb55ad7f483ff3c56f746446778172.tar.gz cpython-d974393419eb55ad7f483ff3c56f746446778172.tar.bz2 |
(Merge 3.2) Issue #13628: python-gdb.py is now able to retrieve more frames in
the Python traceback if Python is optimized.
* delay the lookup of the size_t type, it is not available at startup
* The second argument of the PyFrameObjectPtr constructor is optional, as
done in other constructors
* iter_builtins() and iter_globals() methods of PyFrameObjectPtr returns
an empty tuple instead of None if Python is optimized
* Fix py-bt and py-bt-full to handle correctly "optimized" frames
* Frame.get_pyop() tries to get the frame pointer from PyEval_EvalCodeEx()
if the pointer is optimized out in PyEval_EvalFrameEx()
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_gdb.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index c6ea45c..82dba2e 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -529,6 +529,8 @@ id(foo.__code__)''', re.DOTALL), 'Unexpected gdb representation: %r\n%s' % (gdb_output, gdb_output)) +@unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") class PyListTests(DebuggerTests): def assertListing(self, expected, actual): self.assertEndsWith(actual, expected) @@ -571,6 +573,8 @@ class PyListTests(DebuggerTests): class StackNavigationTests(DebuggerTests): @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_pyup_command(self): 'Verify that the "py-up" command works' bt = self.get_stack_trace(script=self.get_sample_script(), @@ -598,6 +602,8 @@ $''') 'Unable to find an older python frame\n') @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_up_then_down(self): 'Verify "py-up" followed by "py-down"' bt = self.get_stack_trace(script=self.get_sample_script(), @@ -611,6 +617,8 @@ $''') $''') class PyBtTests(DebuggerTests): + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_bt(self): 'Verify that the "py-bt" command works' bt = self.get_stack_trace(script=self.get_sample_script(), @@ -628,6 +636,8 @@ Traceback \(most recent call first\): foo\(1, 2, 3\) ''') + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_bt_full(self): 'Verify that the "py-bt-full" command works' bt = self.get_stack_trace(script=self.get_sample_script(), @@ -639,10 +649,12 @@ Traceback \(most recent call first\): #[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\) bar\(a, b, c\) #[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\) -foo\(1, 2, 3\) + foo\(1, 2, 3\) ''') class PyPrintTests(DebuggerTests): + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_basic_command(self): 'Verify that the "py-print" command works' bt = self.get_stack_trace(script=self.get_sample_script(), @@ -657,12 +669,16 @@ class PyPrintTests(DebuggerTests): self.assertMultilineMatches(bt, r".*\nlocal 'c' = 3\nlocal 'b' = 2\nlocal 'a' = 1\n.*") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_printing_global(self): bt = self.get_stack_trace(script=self.get_sample_script(), cmds_after_breakpoint=['py-print __name__']) self.assertMultilineMatches(bt, r".*\nglobal '__name__' = '__main__'\n.*") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_printing_builtin(self): bt = self.get_stack_trace(script=self.get_sample_script(), cmds_after_breakpoint=['py-print len']) @@ -670,6 +686,8 @@ class PyPrintTests(DebuggerTests): r".*\nbuiltin 'len' = <built-in method len of module object at remote 0x-?[0-9a-f]+>\n.*") class PyLocalsTests(DebuggerTests): + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_basic_command(self): bt = self.get_stack_trace(script=self.get_sample_script(), cmds_after_breakpoint=['py-locals']) @@ -684,8 +702,6 @@ class PyLocalsTests(DebuggerTests): r".*\na = 1\nb = 2\nc = 3\n.*") def test_main(): - if python_is_optimized(): - raise unittest.SkipTest("Python was compiled with optimizations") run_unittest(PrettyPrintTests, PyListTests, StackNavigationTests, |