[issue31622] Make threading.get_ident() return an opaque type
Antoine Pitrou
report at bugs.python.org
Sun Oct 1 13:34:52 EDT 2017
Antoine Pitrou <pitrou at free.fr> added the comment:
> On a system with pthreads, the thread_id that Python provides is merely pthread_t casted to unsigned long. This works today, but is in violation of the standard, and could break on systems with exotic pthread_t.
I don't think that follows. Even if pthread_t is not an integer, it does have a binary representation that can be trivially converted to a arbitrary-sized Python int in Python-facing APIs such as threading.get_ident().
(and similarly, of course, for converting in the other direction e.g. for pthread_kill())
> There is also the ability to introduce undefined behavior, such as sending a signal to an invalid thread id:
I wouldn't worry much about pthread_kill(), a little-used feature.
----------
nosy: +tim.peters
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31622>
_______________________________________
More information about the Python-bugs-list
mailing list