[Python-checkins] cpython (3.3): Issue #19743: fix test_gdb on some optimized Python builds

antoine.pitrou python-checkins at python.org
Sun Nov 24 15:01:49 CET 2013


http://hg.python.org/cpython/rev/e42b449f73fd
changeset:   87503:e42b449f73fd
branch:      3.3
parent:      87480:73c72bd2322b
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sun Nov 24 14:58:17 2013 +0100
summary:
  Issue #19743: fix test_gdb on some optimized Python builds

files:
  Lib/test/test_gdb.py |  12 ++++++++----
  1 files changed, 8 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -141,7 +141,7 @@
             args += [script]
 
         # print args
-        # print ' '.join(args)
+        # print (' '.join(args))
 
         # Use "args" to invoke gdb, capturing stdout, stderr:
         out, err = run_gdb(*args, PYTHONHASHSEED='0')
@@ -186,6 +186,11 @@
         #
         # For a nested structure, the first time we hit the breakpoint will
         # give us the top-level structure
+
+        # NOTE: avoid decoding too much of the traceback as some
+        # undecodable characters may lurk there in optimized mode
+        # (issue #19743).
+        cmds_after_breakpoint = cmds_after_breakpoint or ["backtrace 1"]
         gdb_output = self.get_stack_trace(source, breakpoint=BREAKPOINT_FN,
                                           cmds_after_breakpoint=cmds_after_breakpoint,
                                           import_site=import_site)
@@ -216,11 +221,10 @@
         gdb_output = self.get_stack_trace('id(42)')
         self.assertTrue(BREAKPOINT_FN in gdb_output)
 
-    def assertGdbRepr(self, val, exp_repr=None, cmds_after_breakpoint=None):
+    def assertGdbRepr(self, val, exp_repr=None):
         # Ensure that gdb's rendering of the value in a debugged process
         # matches repr(value) in this process:
-        gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')',
-                                                 cmds_after_breakpoint)
+        gdb_repr, gdb_output = self.get_gdb_repr('id(' + ascii(val) + ')')
         if not exp_repr:
             exp_repr = repr(val)
         self.assertEqual(gdb_repr, exp_repr,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list