summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gdb.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-05-12 22:21:50 (GMT)
committerGitHub <noreply@github.com>2017-05-12 22:21:50 (GMT)
commitd05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88 (patch)
tree3b2e9e2c431b3393a18a212896e6aaecc8729a5a /Lib/test/test_gdb.py
parent3dc7c52a9f4fb83be3e26e31e2c7cd9dc1cb41a2 (diff)
downloadcpython-d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88.zip
cpython-d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88.tar.gz
cpython-d05f7fdf6cf77724bd3064fb5a0846ef5cfe0c88.tar.bz2
[3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
* python-gdb.py supports method-wrapper bpo-29367: python-gdb.py now supports also method-wrapper (wrapperobject) objects. (cherry picked from commit 611083331d534481ca7956a376e38fb0e9ef3854) * Update and enhance python-gdb.py bpo-29259: Detect PyCFunction is the current frame, not only in the older frame.
Diffstat (limited to 'Lib/test/test_gdb.py')
-rw-r--r--Lib/test/test_gdb.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 60f1d92..b7554d6 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -3,13 +3,14 @@
# The code for testing gdb was adapted from similar work in Unladen Swallow's
# Lib/test/test_jit_gdb.py
+import locale
import os
import re
import subprocess
import sys
import sysconfig
+import textwrap
import unittest
-import locale
# Is this Python configured to support threads?
try:
@@ -845,7 +846,24 @@ id(42)
breakpoint='time_gmtime',
cmds_after_breakpoint=['py-bt-full'],
)
- self.assertIn('#0 <built-in method gmtime', gdb_output)
+ self.assertIn('#1 <built-in method gmtime', gdb_output)
+
+ @unittest.skipIf(python_is_optimized(),
+ "Python was compiled with optimizations")
+ def test_wrapper_call(self):
+ cmd = textwrap.dedent('''
+ class MyList(list):
+ def __init__(self):
+ super().__init__() # wrapper_call()
+
+ id("first break point")
+ l = MyList()
+ ''')
+ # Verify with "py-bt":
+ gdb_output = self.get_stack_trace(cmd,
+ cmds_after_breakpoint=['break wrapper_call', 'continue', 'py-bt'])
+ self.assertRegex(gdb_output,
+ r"<method-wrapper u?'__init__' of MyList object at ")
class PyPrintTests(DebuggerTests):