Browse Source

threading.Event is a class for python 3.3+ but not for python 3.2

Xavier Ordoquy 12 years ago
parent
commit
3197bf3eff
1 changed files with 2 additions and 1 deletions
  1. 2 1
      celery/utils/threads.py

+ 2 - 1
celery/utils/threads.py

@@ -18,9 +18,10 @@ from celery.utils.compat import THREAD_TIMEOUT_MAX
 
 
 USE_FAST_LOCALS = os.environ.get('USE_FAST_LOCALS')
 USE_FAST_LOCALS = os.environ.get('USE_FAST_LOCALS')
 PY3 = sys.version_info[0] == 3
 PY3 = sys.version_info[0] == 3
+NEW_EVENT = (sys.version_info[0] == 3) and (sys.version_info[1] >= 3)
 
 
 _Thread = threading.Thread
 _Thread = threading.Thread
-_Event = threading.Event if PY3 else threading._Event
+_Event = threading.Event if NEW_EVENT else threading._Event
 active_count = (getattr(threading, 'active_count', None) or
 active_count = (getattr(threading, 'active_count', None) or
                 threading.activeCount)
                 threading.activeCount)