Re: PL/Python fails on new NetBSD/PPC 8.0 install - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: PL/Python fails on new NetBSD/PPC 8.0 install
Date
Msg-id CA+hUKGKAgZsjDdc0afuf2pB8+aOc2Tm4RHbi9R02OdEciQQLGQ@mail.gmail.com
Whole thread Raw
In response to Re: PL/Python fails on new NetBSD/PPC 8.0 install  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PL/Python fails on new NetBSD/PPC 8.0 install
Re: PL/Python fails on new NetBSD/PPC 8.0 install
Re: PL/Python fails on new NetBSD/PPC 8.0 install
List pgsql-hackers
On Wed, Oct 30, 2019 at 9:25 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> What I'm inclined to do is go file a bug report saying that this
> behavior contradicts both POSIX and NetBSD's own man page, and
> see what they say about that.

From a quick look at the relevant trees, isn't the problem here that
cpython thinks it can reserve pthread_t value -1 (or rather, that
number cast to unsigned long, which is the type it uses for its own
thread IDs):

https://github.com/python/cpython/blob/master/Include/pythread.h#L21

... and then use that to detect lack of initialisation:

https://github.com/python/cpython/blob/master/Modules/_threadmodule.c#L1149

... and that NetBSD also chose the same arbitrary value for their
threading stub library:

https://github.com/NetBSD/src/blob/trunk/lib/libc/thread-stub/thread-stub.c#L392

... as they are entirely within their rights to do?  Assuming the stub
library can do whatever it has to do with that value, like answer
questions like pthread_equal(), as it clearly can.  I think libc is
allowed to implement pthread_t as an integer type and reserve -1, but
application code is not allowed to assume that pthread_t is even
castable to an integer type, let alone that it can reserve magic
values.

Further evidence that this is Python's fault is the admission in the
source code itself that it is "inherently hosed":

https://github.com/python/cpython/blob/master/Python/thread_pthread.h#L299



pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Getting psql to redisplay command after \e
Next
From: Tom Lane
Date:
Subject: Re: PL/Python fails on new NetBSD/PPC 8.0 install