This is the mail archive of the 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]

Re: [patch] Python 2.4 compatibility.

On Mon, Oct 13, 2008 at 2:05 PM, Tom Tromey <> wrote:

> Alternatively, what if we change our 2.4 Py_ssize_t typedef to be a
> #define:
>    #define Py_ssize_t int
> Would this yield the correct results in all cases?

Why #define?

I believe fixing the typedef to be an 'int' works.
Tested 32 and 64-bit build against python2.4 with -Werror.

Paul Pluzhnikov

2008-10-13  Paul Pluzhnikov  <>

	* python/python-internal.h: Fix 64-bit compilation with python2.4

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 5896907..5d5d270 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -33,8 +33,10 @@

 #include "python2.4/Python.h"
-/* Py_ssize_t is not defined until 2.5.  */
-typedef Py_intptr_t Py_ssize_t;
+/* Py_ssize_t is not defined until 2.5.
+   Logical type for Py_ssize_t is Py_intptr_t, but that fails due to
+   several apparent mistakes in python2.4 API, so we use 'int' instead.  */
+typedef int Py_ssize_t;
 #include "python2.5/Python.h"

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