[New-bugs-announce] [issue5632] Bug - threading.currentThread().ident returns None in main thread

Skip Montanaro report at bugs.python.org
Tue Mar 31 23:01:38 CEST 2009


New submission from Skip Montanaro <skip at pobox.com>:

The main thread has an ident, but the threading module doesn't
recognize that fact.  I shouldn't have to "start" the main thread.

Example:

% python
Python 2.7a0 (trunk:70084, Feb 28 2009, 20:51:51) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import threading
>>> import thread
>>> print threading.currentThread(), threading.currentThread().ident, 
thread.get_ident()
<_MainThread(MainThread, started)> None -1602627808

% python3.1
Python 3.1a0 (py3k:70084M, Feb 28 2009, 20:46:48) 
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import threading  
>>> print (threading.current_thread(), 
threading.current_thread().ident)<_MainThread(MainThread, started)> None

----------
components: Library (Lib)
messages: 84901
nosy: skip.montanaro
severity: normal
status: open
title: Bug - threading.currentThread().ident returns None in main thread
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5632>
_______________________________________


More information about the New-bugs-announce mailing list