Quellcode durchsuchen

Merge pull request #2459 from malinoff/fix-task-wrapped

Fix task.__wrapped__ to work properly with inspect.Signature
Ask Solem Hoel vor 10 Jahren
Ursprung
Commit
d012994dbe
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 3 2
      celery/app/base.py

+ 3 - 2
celery/app/base.py

@@ -279,15 +279,16 @@ class Celery(object):
         base = base or self.Task
 
         if name not in self._tasks:
+            run = fun if bind else staticmethod(fun)
             task = type(fun.__name__, (base, ), dict({
                 'app': self,
                 'name': name,
-                'run': fun if bind else staticmethod(fun),
+                'run': run,
                 '_decorated': True,
                 '__doc__': fun.__doc__,
                 '__module__': fun.__module__,
                 '__header__': staticmethod(head_from_fun(fun, bound=bind)),
-                '__wrapped__': fun}, **options))()
+                '__wrapped__': run}, **options))()
             self._tasks[task.name] = task
             task.bind(self)  # connects task to this app
         else: