Re: [patch] Fix Python 3 build error on 32-bit hosts

Pedro Alves
2015-02-04T19:08:36Z

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
>