This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pdox
Recipients pdox
Date 2017-09-29.00:39:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Currently, Python exposes "thread identifiers" as unsigned long values across multiple modules:

threading.get_ident() -> Returns an integer thread id
sys._current_frames() -> Dictionary keys are integer thread ids
signal.pthread_kill() -> Accepts an arbitrary integer thread id

In reality, OS level thread identifiers are opaque types. 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.

There is also the ability to introduce undefined behavior, such as sending a signal to an invalid thread id:

>>> signal.pthread_kill(42, signal.SIGHUP)
Segmentation fault (core dumped)

Changing the thread identifiers to an opaque type (which also tracks the validity of the thread id, for blocking use of expired system thread ids) will solve these two issues.
Date User Action Args
2017-09-29 00:39:32pdoxsetrecipients: + pdox
2017-09-29 00:39:32pdoxsetmessageid: <>
2017-09-29 00:39:32pdoxlinkissue31622 messages
2017-09-29 00:39:30pdoxcreate