gdb/gdb-python3-testsuite.patch

57 lines
1.8 KiB
Diff

http://sourceware.org/ml/gdb-patches/2015-02/msg00361.html
Subject: PR python/17927 (Python 3 testsuite compatability)
This patch updates the Python testsuite to maintain Python 3
compatibility. I'll check it in under the obvious tomorrow (if
nobody objects otherwise.)
Cheers
Phil
2015-02-16 Phil Muldoon <pmuldoon@redhat.com>
PR python/17927
* gdb.python/py-objfile.exp: Use print ()
* gdb.python/py-type.exp: Ditto.
* gdb.python/py-framefilter.py: Update to use map in
Python 3.
--
diff --git a/gdb/testsuite/gdb.python/py-framefilter.py b/gdb/testsuite/gdb.python/py-framefilter.py
index 0de026c..8c65edc 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.py
+++ b/gdb/testsuite/gdb.python/py-framefilter.py
@@ -145,7 +145,10 @@ class ErrorFilter():
gdb.frame_filters [self.name] = self
def filter(self, frame_iter):
- return itertools.imap(ErrorInName, frame_iter)
+ if hasattr(itertools, "imap"):
+ return itertools.imap(ErrorInName, frame_iter)
+ else:
+ return map(ErrorInName, frame_iter)
FrameFilter()
FrameElider()
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index c4c8d9f..6c4e5f8 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -247,10 +247,10 @@ restart_gdb "${binfile}"
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
-gdb_test "python print gdb.lookup_type('char').array(1, 0)" \
+gdb_test "python print (gdb.lookup_type('char').array(1, 0))" \
"char \\\[0\\\]"
-gdb_test "python print gdb.lookup_type('char').array(1, -1)" \
+gdb_test "python print (gdb.lookup_type('char').array(1, -1))" \
"Array length must not be negative.*"
with_test_prefix "lang_c" {