This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PR python/17927 (Python 3 testsuite compatability)
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Date: Mon, 16 Feb 2015 13:31:16 +0000
- Subject: PR python/17927 (Python 3 testsuite compatability)
- Authentication-results: sourceware.org; auth=none
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-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index b53f5e3..7df1732 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -88,9 +88,9 @@ if { [gdb_unload] < 0 } {
return -1
}
-gdb_test "python print objfile.filename" "None" \
+gdb_test "python print (objfile.filename)" "None" \
"objfile.filename after objfile is unloaded"
-gdb_test "python print objfile.username" "None" \
+gdb_test "python print (objfile.username)" "None" \
"objfile.username after objfile is unloaded"
# Now build another copy of the testcase, this time without debug info.
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" {