This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix definition of Py_ssize_t
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 05 Jan 2009 13:47:52 -0700
- Subject: FYI: fix definition of Py_ssize_t
- Reply-to: Tom Tromey <tromey at redhat dot com>
Today I couldn't build gdb against Python 2.4, because the
compatibility define for Py_ssize_t is incorrect.
I'm checking in the appended as obvious. This is the code we've been
using on the Python branch for a while.
Built on the compile farm to check.
Tom
2009-01-05 Tom Tromey <tromey@redhat.com>
* python/python-internal.h (Py_ssize_t): Define as int.
Index: python/python-internal.h
===================================================================
RCS file: /cvs/src/src/gdb/python/python-internal.h,v
retrieving revision 1.5
diff -u -r1.5 python-internal.h
--- python/python-internal.h 3 Jan 2009 05:57:57 -0000 1.5
+++ python/python-internal.h 5 Jan 2009 20:45:59 -0000
@@ -33,8 +33,11 @@
#if HAVE_LIBPYTHON2_4
#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 in 64-bit
+ compilation due to several apparent mistakes in python2.4 API, so we
+ use 'int' instead. */
+typedef int Py_ssize_t;
#elif HAVE_LIBPYTHON2_5
#include "python2.5/Python.h"
#elif HAVE_LIBPYTHON2_6