aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTim Wiederhake <tim.wiederhake@intel.com>2017-03-21 08:19:59 +0100
committerTim Wiederhake <tim.wiederhake@intel.com>2017-03-21 08:19:59 +0100
commitcee59b3feac9a8f6300a5b788e3db4e15af2a894 (patch)
tree3ae196bdbd61797105f0c3b50c34dc8ecbc8b027 /gdb/python
parent09220eae9df07c40d206a35e6caaecba92ab8f46 (diff)
downloadgdb-cee59b3feac9a8f6300a5b788e3db4e15af2a894.zip
gdb-cee59b3feac9a8f6300a5b788e3db4e15af2a894.tar.gz
gdb-cee59b3feac9a8f6300a5b788e3db4e15af2a894.tar.bz2
Fix break on Python 2
This changes the return type of "gdb.BtraceInstruction.data ()" from "memoryview" to "buffer" on Python 2.7 and below, similar to what "gdb.Inferior.read_memory ()" does.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-record-btrace.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index 6158f31..c816332 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -330,7 +330,12 @@ btpy_insn_data (PyObject *self, void *closure)
if (object == NULL)
return NULL;
+#ifdef IS_PY3K
return PyMemoryView_FromObject (object);
+#else
+ return PyBuffer_FromObject (object, 0, Py_END_OF_BUFFER);
+#endif
+
}
/* Implementation of BtraceInstruction.decode [str]. Returns