Преглед на файлове

Merge pull request #1678 from limnick/master

fix old callable with new builtin callable
Ask Solem Hoel преди 11 години
родител
ревизия
edab6f103d
променени са 1 файла, в които са добавени 2 реда и са изтрити 4 реда
  1. 2 4
      celery/utils/dispatch/saferef.py

+ 2 - 4
celery/utils/dispatch/saferef.py

@@ -10,8 +10,6 @@ from __future__ import absolute_import
 import weakref
 import traceback
 
-from collections import Callable
-
 __all__ = ['safe_ref']
 
 
@@ -35,7 +33,7 @@ def safe_ref(target, on_delete=None):  # pragma: no cover
             don't know how to create reference""".format(target)
         return get_bound_method_weakref(target=target,
                                         on_delete=on_delete)
-    if isinstance(on_delete, Callable):
+    if callable(on_delete):
         return weakref.ref(target, on_delete)
     else:
         return weakref.ref(target)
@@ -140,7 +138,7 @@ class BoundMethodWeakref(object):  # pragma: no cover
                 pass
             for function in methods:
                 try:
-                    if isinstance(function, Callable):
+                    if callable(function):
                         function(self)
                 except Exception as exc:
                     try: