This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[python] second fix for python-membuf.c


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 = {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]