Prechádzať zdrojové kódy

cry sighandler does not work on Python 2.4, as sys._current_frames is not available there

Ask Solem 14 rokov pred
rodič
commit
462822a55f

+ 3 - 0
celery/apps/worker.py

@@ -305,6 +305,9 @@ def install_worker_restart_handler(worker):
 
 
 def install_cry_handler(logger):
+    if sys.version_info <= (2, 4):
+        # 2.4 does not have sys._current_frames
+        return
 
     def cry_handler(signum, frame):
         """Signal handler logging the stacktrace of all active threads."""

+ 3 - 0
celery/tests/test_bin/test_celeryd.py

@@ -5,6 +5,7 @@ import warnings
 
 from multiprocessing import get_logger, current_process
 
+from nose import SkipTest
 from kombu.tests.utils import redirect_stdouts
 
 from celery import Celery
@@ -442,6 +443,8 @@ class test_signal_handlers(unittest.TestCase):
         self.assertTrue(worker.stopped)
 
     def test_worker_cry_handler(self):
+        if sys.version_info <= (2, 4):
+            raise SkipTest("Needs Python 2.5 or later")
 
         class Logger(object):
             _errors = []