[New-bugs-announce] [issue6532] thread.get_ident() should return unsigned value
report at bugs.python.org
Tue Jul 21 16:25:25 CEST 2009
New submission from Wojciech Lichota <wojciech at lichota.pl>:
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.
>>> import thread
In some cases it returns negative value.
Checked in python 2.4, 2.5, 2.6
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:
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.
components: Library (Lib)
title: thread.get_ident() should return unsigned value
versions: Python 2.4, Python 2.5, Python 2.6
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce