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]

[patch] Python 2.4 compatibility.


Greetings,

Current git source fails to build with python 2.4.
Attached patch fixes that, but I am not sure that's the best (or
even correct) fix.

Thanks,

--
Paul Pluzhnikov


2008-10-13  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb/python/python.c (find_pretty_printer): Python2.4 compatibility.
	* gdb/python/python-value.c (valpy_length): Likewise.

commit 57d9ef09e581a214ff9ae2abfb19805ce9cd0847
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date:   Mon Oct 13 10:38:08 2008 -0700

    Made code compile with python2.4 headers.

diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 02c3fec..38faeaf 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -60,7 +60,12 @@ typedef struct {
 static void valpy_dealloc (PyObject *obj);
 static PyObject *valpy_new (PyTypeObject *subtype, PyObject *args,
 			    PyObject *keywords);
-static Py_ssize_t valpy_length (PyObject *self);
+#if PYTHON_API_VERSION <= 1012
+typedef int length_t;
+#else
+typedef Py_ssize_t length_t;
+#endif
+static length_t valpy_length (PyObject *self);
 static PyObject *valpy_getitem (PyObject *self, PyObject *key);
 static int valpy_setitem (PyObject *self, PyObject *key, PyObject *value);
 static PyObject *valpy_str (PyObject *self);
@@ -279,7 +284,7 @@ valpy_cast (PyObject *self, PyObject *args)
   return value_to_value_object (res_val);
 }
 
-static Py_ssize_t
+static length_t
 valpy_length (PyObject *self)
 {
   /* We don't support getting the number of elements in a struct / class.  */
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 20bd1a9..3f76772 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -667,7 +667,11 @@ static PyObject *
 find_pretty_printer (struct type *type, PyObject **dictp, char *dict_name)
 {
   PyObject *dict, *key, *func, *found = NULL;
+#if PYTHON_API_VERSION <= 1012
+  int iter;
+#else
   Py_ssize_t iter;
+#endif
   char *type_name = NULL;
   volatile struct gdb_exception except;
 


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