File py26-formatwarning.diff of Package python-cherrypy

http://cherrypy.org/changeset/2096
Index: trunk/cherrypy/_cpchecker.py
===================================================================
--- trunk/cherrypy/_cpchecker.py (revision 2089)
+++ trunk/cherrypy/_cpchecker.py (revision 2096)
@@ -40,5 +40,5 @@
                 warnings.formatwarning = oldformatwarning
     
-    def formatwarning(self, message, category, filename, lineno):
+    def formatwarning(self, message, category, filename, lineno, line=None):
         """Function to format a warning."""
         return "CherryPy Checker:\n%s\n\n" % message
Index: trunk/cherrypy/lib/caching.py
===================================================================
--- trunk/cherrypy/lib/caching.py (revision 1798)
+++ trunk/cherrypy/lib/caching.py (revision 2096)
@@ -18,5 +18,9 @@
         t = threading.Thread(target=self.expire_cache, name='expire_cache')
         self.expiration_thread = t
-        t.setDaemon(True)
+        if hasattr(threading.Thread, "daemon"):
+            # Python 2.6+
+            t.daemon = True
+        else:
+            t.setDaemon(True)
         t.start()
     
Index: trunk/cherrypy/process/wspbus.py
===================================================================
--- trunk/cherrypy/process/wspbus.py (revision 2037)
+++ trunk/cherrypy/process/wspbus.py (revision 2096)
@@ -244,8 +244,13 @@
         self.log("Waiting for child threads to terminate...")
         for t in threading.enumerate():
-            if (t != threading.currentThread() and t.isAlive()
+            if t != threading.currentThread() and t.isAlive():
                 # Note that any dummy (external) threads are always daemonic.
-                and not t.isDaemon()):
-                t.join()
+                if hasattr(threading.Thread, "daemon"):
+                    # Python 2.6+
+                    d = t.daemon
+                else:
+                    d = t.isDaemon()
+                if not d:
+                    t.join()
         
         if self.execv:
openSUSE Build Service is sponsored by