Skip to content

Commit

Permalink
Fix AttributeError when sig is not a Signature. (#5297)
Browse files Browse the repository at this point in the history
* Fix AttributeError when `sig` is not a Signature.

Fixes #5265.  Test is pending.

* Don't use 'isinstance' so that Mock objects are allowed in tests.
  • Loading branch information
mvaled authored and auvipy committed Jan 29, 2019
1 parent cd1fb08 commit dc1d895
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion celery/canvas.py
Expand Up @@ -1045,7 +1045,13 @@ def link(self, sig):
return self.tasks[0].link(sig)

def link_error(self, sig):
sig = sig.clone().set(immutable=True)
try:
sig = sig.clone().set(immutable=True)
except AttributeError:
# See issue #5265. I don't use isinstance because current tests
# pass a Mock object as argument.
sig['immutable'] = True
sig = Signature.from_dict(sig)
return self.tasks[0].link_error(sig)

def _prepared(self, tasks, partial_args, group_id, root_id, app,
Expand Down

0 comments on commit dc1d895

Please sign in to comment.