Message8042

Author oberstet
Recipients oberstet
Date 2013-06-12.08:02:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371024155.23.0.557886030514.issue2060@psf.upfronthosting.co.za>
In-reply-to
Content
Thread identifier seems to be missing:

   C:\jython2.7b1\bin>jython
   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 http://twistedmatrix.com/trac/ticket/3413):

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

As a workaround, patch `twisted.python.threadable.py` for

   _dummyID = object()
   def getThreadID():
       if threadingmodule is None:
           return _dummyID
       try:
           # workaround for broken Jython
           tid = threadingmodule.currentThread().ident
           return tid
       except AttributeError:
           return _dummyID
History
Date User Action Args
2013-06-12 08:02:35oberstetsetrecipients: + oberstet
2013-06-12 08:02:35oberstetsetmessageid: <1371024155.23.0.557886030514.issue2060@psf.upfronthosting.co.za>
2013-06-12 08:02:34oberstetlinkissue2060 messages
2013-06-12 08:02:34oberstetcreate