Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object.  feature request issue 2871.
diff --git a/Lib/threading.py b/Lib/threading.py
index d497a46..0d34b6a 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -414,6 +414,7 @@
         self.__args = args
         self.__kwargs = kwargs
         self.__daemonic = self._set_daemon()
+        self.__ident = None
         self.__started = Event()
         self.__stopped = False
         self.__block = Condition(Lock())
@@ -434,7 +435,9 @@
         if self.__stopped:
             status = "stopped"
         if self.__daemonic:
-            status = status + " daemon"
+            status += " daemon"
+        if self.__ident is not None:
+            status += " %s" % self.__ident
         return "<%s(%s, %s)>" % (self.__class__.__name__, self.__name, status)
 
     def start(self):
@@ -481,9 +484,10 @@
 
     def __bootstrap_inner(self):
         try:
+            self.__ident = _get_ident()
             self.__started.set()
             _active_limbo_lock.acquire()
-            _active[_get_ident()] = self
+            _active[self.__ident] = self
             del _limbo[self]
             _active_limbo_lock.release()
             if __debug__:
@@ -635,6 +639,10 @@
         assert self.__initialized, "Thread.__init__() not called"
         self.__name = str(name)
 
+    def getIdent(self):
+        assert self.__initialized, "Thread.__init__() not called"
+        return self.__ident
+
     def isAlive(self):
         assert self.__initialized, "Thread.__init__() not called"
         return self.__started.isSet() and not self.__stopped