Parcourir la source

Fixes compatibility with pycallgraph. Closes #1051

Ask Solem il y a 12 ans
Parent
commit
8637e30215
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      celery/local.py

+ 4 - 3
celery/local.py

@@ -124,10 +124,11 @@ class Proxy(object):
         object behind the proxy at a time for performance reasons or because
         object behind the proxy at a time for performance reasons or because
         you want to pass the object into a different context.
         you want to pass the object into a different context.
         """
         """
-        if not hasattr(self.__local, '__release_local__'):
-            return self.__local(*self.__args, **self.__kwargs)
+        loc = object.__getattribute__(self, '_Proxy__local')
+        if not hasattr(loc, '__release_local__'):
+            return loc(*self.__args, **self.__kwargs)
         try:
         try:
-            return getattr(self.__local, self.__name__)
+            return getattr(loc, self.__name__)
         except AttributeError:
         except AttributeError:
             raise RuntimeError('no object bound to %s' % self.__name__)
             raise RuntimeError('no object bound to %s' % self.__name__)