This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] second fix for python-membuf.c
- From: Tom Tromey <tromey at redhat dot com>
- To: Project Archer <archer at sourceware dot org>
- Date: Thu, 08 Jan 2009 16:13:44 -0700
- Subject: [python] second fix for python-membuf.c
- Reply-to: Tom Tromey <tromey at redhat dot com>
My python-membuf.c fix yesterday worked for me, but it didn't build
for Rick. Looking more closely, I see that Python added a new type
name in 2.5 and used this in the relevant struct, but kept the old
name as it was. Weird.
This patch is a workaround that worked for Rick.
Tom
2009-01-08 Tom Tromey <tromey@redhat.com>
* python/python-membuf.c (CHARBUFFERPROC_NAME): New define.
(buffer_procs): Use it.
diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c
index 1b57da7..df8849d 100644
--- a/gdb/python/python-membuf.c
+++ b/gdb/python/python-membuf.c
@@ -168,13 +168,20 @@ get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr)
return get_char_buffer (self, segment, ptrptr);
}
+/* Python doesn't provide a decent way to get compatibility here. */
+#if HAVE_LIBPYTHON2_4
+#define CHARBUFFERPROC_NAME getcharbufferproc
+#else
+#define CHARBUFFERPROC_NAME charbufferproc
+#endif
+
static PyBufferProcs buffer_procs = {
get_read_buffer,
get_write_buffer,
get_seg_count,
/* The cast here works around a difference between Python 2.4 and
Python 2.5. */
- (getcharbufferproc) get_char_buffer
+ (CHARBUFFERPROC_NAME) get_char_buffer
};
static PyTypeObject membuf_object_type = {