Parcourir la source

Fix mro_lookup

Ask Solem il y a 12 ans
Parent
commit
e8f0039654
1 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 8 4
      celery/task/trace.py

+ 8 - 4
celery/task/trace.py

@@ -66,10 +66,14 @@ def mro_lookup(cls, attr, stop=(), monkey_patched=[]):
     """
     for node in cls.mro():
         if node in stop:
-            attr = node.__dict__.get(attr)
-            module_origin = getattr(attr, '__module__', None)
-            if module_origin not in monkey_patched:
-                return node
+            try:
+                attr = node.__dict__[attr]
+                module_origin = attr.__module__
+            except (AttributeError, KeyError):
+                pass
+            else:
+                if module_origin not in monkey_patched:
+                    return node
             return
         if attr in node.__dict__:
             return node