Skip to content

Commit d012994

Browse files
committed
Merge pull request celery#2459 from malinoff/fix-task-wrapped
Fix task.__wrapped__ to work properly with inspect.Signature
2 parents 102ee8f + fbe2f8e commit d012994

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

celery/app/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,16 @@ def _task_from_fun(self, fun, name=None, base=None, bind=False, **options):
279279
base = base or self.Task
280280

281281
if name not in self._tasks:
282+
run = fun if bind else staticmethod(fun)
282283
task = type(fun.__name__, (base, ), dict({
283284
'app': self,
284285
'name': name,
285-
'run': fun if bind else staticmethod(fun),
286+
'run': run,
286287
'_decorated': True,
287288
'__doc__': fun.__doc__,
288289
'__module__': fun.__module__,
289290
'__header__': staticmethod(head_from_fun(fun, bound=bind)),
290-
'__wrapped__': fun}, **options))()
291+
'__wrapped__': run}, **options))()
291292
self._tasks[task.name] = task
292293
task.bind(self) # connects task to this app
293294
else:

0 commit comments

Comments
 (0)