This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix Python 3 build error on 32-bit hosts
- From: Pedro Alves <palves at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 04 Feb 2015 20:08:25 +0100
- Subject: Re: [patch] Fix Python 3 build error on 32-bit hosts
- Authentication-results: sourceware.org; auth=none
- References: <20150204174311 dot GA24375 at host1 dot jankratochvil dot net> <54D26BCA dot 2000505 at redhat dot com>
On 02/04/2015 07:58 PM, Pedro Alves wrote:
> On 02/04/2015 06:43 PM, Jan Kratochvil wrote:
>
>> A question is whether the autoconf test isn't an overkill.
>
> I agree with Paul here. I think checking Python version is sufficient.
>
> One could use
>> instead just:
>> #if PYTHON_ABI_VERSION >= 3
>
> This
>
> https://docs.python.org/3/c-api/object.html#PyObject_Hash
>
> and a quick web search for Py_hash_t seems to indicate that we should
> check for Python >=3.2, not just 3.
Seems like the easiest for that is PY_VERSION_HEX.
Supposedly this should work:
#if PY_VERSION_HEX >= 0x03020000
Thanks,
Pedro Alves
>
>> Also one could use that #if either just at the valpy_hash() definition or one
>> could provide Py_hash_t in gdb/defs.h or one could provide some GDB_Py_hash_t
>> in gdb/defs.h.
>
> I'd be fine with providing a fallback Py_hash_t in python/python-internal.h,
> where we already do a series of fallback definitions and fixes for older
> Python, such as e.g. Py_ssize_t.
>
> Thanks,
> Pedro Alves
>