[issue6532] thread.get_ident() should return unsigned value

2017-03-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2017-03-24 Thread STINNER Victor

STINNER Victor added the comment:


New changeset aefa7ebf0ff0f73feee7ab24f4cdcb2014d83ee5 by Victor Stinner 
(Serhiy Storchaka) in branch 'master':
bpo-6532: Make the thread id an unsigned integer. (#781)
https://github.com/python/cpython/commit/aefa7ebf0ff0f73feee7ab24f4cdcb2014d83ee5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2017-03-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +685

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2015-02-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Victor for your review. Here is updated patch.

--
Added file: http://bugs.python.org/file38168/thread_id_unsigned_4.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2015-02-18 Thread STINNER Victor

STINNER Victor added the comment:

> Here is updated patch. Added few tests.

Cool. I sent a review.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2015-02-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is updated patch. Added few tests.

--
Added file: http://bugs.python.org/file38167/thread_id_unsigned_3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2015-02-17 Thread STINNER Victor

STINNER Victor added the comment:

On Linux, the following C program tells me that pthread_t is unsigned.
---
#include 
#include 

#define TYPE_IS_SIGNED(TYPE) ((TYPE)-1 < (TYPE)0)

int main()
{
printf("signed? %i\n", TYPE_IS_SIGNED(pthread_t));
return 0;
}
---

So it's fair to modify threading.get_ident() to return an unsigned number.

But I disagree to change stable Python versions, it may break applications.

Oh, I wrote write_thread_id() in Python/traceback.c and this function already 
casts the thread identifier to an unsigned number ;-)

--
nosy: +haypo
versions: +Python 3.5 -Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2014-02-03 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2013-02-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

You could add a test for it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2013-02-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch, which made all thread id to be unsigned.

--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file28976/thread_id_unsigned.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2013-02-06 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 3.3, Python 3.4 -Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2011-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> no, DWORD is a 32-bit unsigned integer
> http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx

Oops, my bad.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2011-01-05 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

no, DWORD is a 32-bit unsigned integer
http://msdn.microsoft.com/en-us/library/aa383751(VS.85).aspx

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2011-01-05 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, the issue is that signedness differs depending on the platform. Under 
Windows, thread ids are signed (DWORD). Satisfying all cases would complicate 
things quite a bit.

--
nosy: +gregory.p.smith, pitrou, rnk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2010-08-01 Thread Mark Lawrence

Mark Lawrence  added the comment:

Can a C guru comment on this please.

--
components: +Extension Modules -Library (Lib)
nosy: +BreamoreBoy
stage:  -> needs patch
type:  -> behavior
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.4, Python 2.5, Python 
2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6532] thread.get_ident() should return unsigned value

2009-07-21 Thread Wojciech Lichota

New submission from Wojciech Lichota :

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.

--
components: Library (Lib)
messages: 90761
nosy: sargo
severity: normal
status: open
title: thread.get_ident() should return unsigned value
versions: Python 2.4, Python 2.5, Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com