diff -r 3f971d6907b7 Lib/threading.py --- a/Lib/threading.py Tue Jun 04 14:50:21 2013 -0700 +++ b/Lib/threading.py Wed Jun 12 11:32:14 2013 -0700 @@ -92,13 +92,24 @@ class JavaThread(object): def __init__(self, thread): + self.__ident = None self._thread = thread _register_thread(thread, self) + @property + def ident(self): + return self.__ident + + def _set_ident(self): + self.__ident = self._thread.getId() + def __repr__(self): _thread = self._thread status = ThreadStates[_thread.getState()] - if _thread.isDaemon(): status + " daemon" + if _thread.isDaemon(): + status += " daemon" + if self.__ident is not None: + status += " %s" % self.__ident return "<%s(%s, %s)>" % (self.__class__.__name__, self.getName(), status) def __eq__(self, other): @@ -176,6 +187,7 @@ def __bootstrap(self): try: + self._set_ident() if _trace_hook: _sys.settrace(_trace_hook) if _profile_hook: @@ -239,6 +251,7 @@ Thread.__init__(self, name="MainThread") import atexit atexit.register(self.__exitfunc) + self._set_ident() def _create_thread(self): return java.lang.Thread.currentThread() @@ -264,6 +277,7 @@ pythread = _jthread_to_pythread[jthread] if pythread is None: pythread = JavaThread(jthread) + pythread._set_ident() return pythread current_thread = currentThread