Merged revisions 57152-57220 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r57155 | brett.cannon | 2007-08-17 11:51:57 -0700 (Fri, 17 Aug 2007) | 2 lines

  Clarify the comment about setting the PYTHON variable for the Doc Makefile.
........
  r57156 | brett.cannon | 2007-08-17 11:59:58 -0700 (Fri, 17 Aug 2007) | 3 lines

  Remove news entry for test.test_support.guard_warnings_filter as it has been
  removed.
........
  r57158 | facundo.batista | 2007-08-17 12:16:44 -0700 (Fri, 17 Aug 2007) | 9 lines


  Added a flag (_send_traceback_header) to the SimpleXMLRPCServer class
  that allows sending back exception/stack trace information about
  internal server errors (this flag defaults to False to avoid sending
  such information unless explicitly enabled).  Added tests to verify
  behavior of this new feature (these tests are skipped on win32 because
  of problems with WSAEWOULDBLOCK). Renamed HTTPTestCase to
  SimpleServerTestCase. [GSoC - Alan McIntyre]
........
  r57160 | brett.cannon | 2007-08-17 13:16:15 -0700 (Fri, 17 Aug 2007) | 2 lines

  Make test_warnings re-entrant.
........
  r57175 | georg.brandl | 2007-08-17 23:05:56 -0700 (Fri, 17 Aug 2007) | 2 lines

  Fix PDB command descriptions.
........
  r57182 | brett.cannon | 2007-08-18 11:30:36 -0700 (Sat, 18 Aug 2007) | 3 lines

  Remove Mikael as the maintainer of BeOS at his request.  With no maintainer
  should the port be deprecated in 2.6?
........
  r57199 | georg.brandl | 2007-08-19 11:43:50 -0700 (Sun, 19 Aug 2007) | 2 lines

  Fix stray backticks.
........
  r57211 | hyeshik.chang | 2007-08-19 23:49:18 -0700 (Sun, 19 Aug 2007) | 2 lines

  Add cheot-ga-keut composed make-up sequence support in EUC-KR codec.
........
  r57216 | guido.van.rossum | 2007-08-20 08:18:04 -0700 (Mon, 20 Aug 2007) | 4 lines

  Add a hack (originally devised in a slightly different form by Thomas Wouters)
  to prevent spurious tracebacks when a daemon thread's cleanup happens to wake
  up when the world around it has already been destroyed.
........
diff --git a/Lib/threading.py b/Lib/threading.py
index cae2f77..4ba7252 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -445,6 +445,26 @@
             self.__target(*self.__args, **self.__kwargs)
 
     def __bootstrap(self):
+        # Wrapper around the real bootstrap code that ignores
+        # exceptions during interpreter cleanup.  Those typically
+        # happen when a daemon thread wakes up at an unfortunate
+        # moment, finds the world around it destroyed, and raises some
+        # random exception *** while trying to report the exception in
+        # __bootstrap_inner() below ***.  Those random exceptions
+        # don't help anybody, and they confuse users, so we suppress
+        # them.  We suppress them only when it appears that the world
+        # indeed has already been destroyed, so that exceptions in
+        # __bootstrap_inner() during normal business hours are properly
+        # reported.  Also, we only suppress them for daemonic threads;
+        # if a non-daemonic encounters this, something else is wrong.
+        try:
+            self.__bootstrap_inner()
+        except:
+            if self.__daemonic and _sys is None:
+                return
+            raise
+
+    def __bootstrap_inner(self):
         try:
             self.__started = True
             _active_limbo_lock.acquire()