This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: [patch] Python 2.4 compatibility.
- From: "Paul Pluzhnikov" <ppluzhnikov at google dot com>
- To: "Tom Tromey" <tromey at redhat dot com>
- Cc: archer at sourceware dot org
- Date: Mon, 13 Oct 2008 15:53:48 -0700
- Subject: Re: [patch] Python 2.4 compatibility.
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1223938431; bh=4yS4Ap/YGMZ/krgdmkWtDsL+AQo=;h=DomainKey-Signature:Message-ID:Date:From:To:Subject:Cc: In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-Disposition:References; b=yaV1I40xCHKQCk1lwbfrCh7weG4icLYMLPrFwzRiyuMFFx2hBrKvnlgtWriyUIDE+fV5HbDA8SWt6sD1Cx7yFQ==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;b=enIB/4CHo/5GoI+TVFLWZ8hF1zu2narazKi5fGSqoYQC08SK8Nyct7rLn2ZhOOKffbBp/iAVVX9JEdQZ7LXqpg==
- References: <20081013181729.103A63A6AF3@localhost> <m3tzbgmje5.fsf@fleche.redhat.com> <8ac60eac0810131330h505f71b0x25b64df36550863e@mail.gmail.com> <m3tzbgjjdk.fsf@fleche.redhat.com>
On Mon, Oct 13, 2008 at 2:05 PM, Tom Tromey <tromey@redhat.com> 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.
OK?
--
Paul Pluzhnikov
2008-10-13 Paul Pluzhnikov <ppluzhnikov@google.com>
* 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 @@
#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 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