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 sargo
Recipients sargo
Date 2009-07-21.14:25:20
SpamBayes Score 8.927764e-11
Marked as misclassified No
Message-id <1248186325.01.0.817161707988.issue6532@psf.upfronthosting.co.za>
In-reply-to
Content
In glibc library (on linux) pthread_t is defined as:

typedef unsigned long int pthread_t;

But python thread module interprets this value as signed long. 

Reproduce:
>>> import thread
>>> thread.get_ident()
In some cases it returns negative value.
Checked in python 2.4, 2.5, 2.6

Proposal:
In my opinion code that cast value returned by pthread_self() should be
changed (see: Python/thread_pthread.h).

Other possibility is to change only returned value by get_ident
function. In this case it should use PyLong_FromUnsignedLong (see:
Modules/threadmodule.c).

Background:
logging module uses 'thread.get_ident()' to save thread_id in logs. If
the same application uses some C library that also writes in log file
some info with thread_id, in some situations this numbers are diffrent.
This complicate logs analyze.
History
Date User Action Args
2009-07-21 14:25:25sargosetrecipients: + sargo
2009-07-21 14:25:25sargosetmessageid: <1248186325.01.0.817161707988.issue6532@psf.upfronthosting.co.za>
2009-07-21 14:25:21sargolinkissue6532 messages
2009-07-21 14:25:20sargocreate