Title: Thread ident missing
Type: Severity: normal
Components: Core Versions: Jython 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: amak, oberstet, zyasoft
Priority: Keywords: patch

Created on 2013-06-12.08:02:34 by oberstet, last changed 2013-09-11.01:03:19 by zyasoft.

File name Uploaded Description Edit Remove
threading_ident.diff santa4nt, 2013-06-12.18:30:42 Injecting the 'ident' property to threading.Thread objects.
msg8042 (view) Author: Tobias Oberstein (oberstet) Date: 2013-06-12.08:02:34
Thread identifier seems to be missing:

   Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
   [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import threading
   >>> threading.currentThread().ident
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
   AttributeError: '_MainThread' object has no attribute 'ident'

This breaks Twisted 13.0 (already patched as described in

   Traceback (most recent call last):
     File "wstest", line 7, in <module>
     File "C:\jython2.7b1\Lib\site-packages\autobahntestsuite-0.5.4-py2.7.egg\autobahntestsuite\", line 351, in run
     File "C:\jython2.7b1\Lib\site-packages\twisted-13.0.0-py2.7.egg\twisted\internet\", line 1191, in run
     File "C:\jython2.7b1\Lib\site-packages\twisted-13.0.0-py2.7.egg\twisted\internet\", line 1171, in startRunning
     File "C:\jython2.7b1\Lib\site-packages\twisted-13.0.0-py2.7.egg\twisted\internet\", line 687, in startRunning
     File "C:\jython2.7b1\Lib\site-packages\twisted-13.0.0-py2.7.egg\twisted\python\", line 122, in registerAsIOThread
       ioThread = getThreadID()
     File "C:\jython2.7b1\Lib\site-packages\twisted-13.0.0-py2.7.egg\twisted\python\", line 107, in getThreadID
       return threadingmodule.currentThread().ident
   AttributeError: '_MainThread' object has no attribute 'ident'   

As a workaround, patch `` for

   _dummyID = object()
   def getThreadID():
       if threadingmodule is None:
           return _dummyID
           # workaround for broken Jython
           tid = threadingmodule.currentThread().ident
           return tid
       except AttributeError:
           return _dummyID
msg8069 (view) Author: Jim Baker (zyasoft) Date: 2013-07-19.19:08:07
Verified; note that we are currently skipping a test that tests this functionality (test_threading.test_various_ops) reports this was added in 2.6, so it's just a gap in getting that implemented.
msg8070 (view) Author: Jim Baker (zyasoft) Date: 2013-07-19.22:37:48
Fixed in 7112:9ad4f341f030
msg8107 (view) Author: Alan Kennedy (amak) Date: 2013-09-07.13:47:10
If this is fixed, does the bug report need to be left open?
msg8112 (view) Author: Jim Baker (zyasoft) Date: 2013-09-11.01:03:19
My bad, now closed.
Date User Action Args
2013-09-11 01:03:19zyasoftsetstatus: open -> closed
messages: + msg8112
2013-09-07 13:47:10amaksetnosy: + amak
messages: + msg8107
2013-07-19 22:37:48zyasoftsetresolution: accepted -> fixed
messages: + msg8070
2013-07-19 19:08:08zyasoftsetassignee: zyasoft
resolution: accepted
messages: + msg8069
nosy: + zyasoft
2013-06-12 18:30:43santa4ntsetfiles: + threading_ident.diff
keywords: + patch
2013-06-12 08:02:35oberstetcreate