Skip to content

Commit

Permalink
Update Executor.submit(): handle TypeError exceptions of issubclass()…
Browse files Browse the repository at this point in the history
… and isinstance()
  • Loading branch information
Greg Leclercq committed Jul 16, 2014
1 parent f9454d1 commit 8faa863
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions simpleflow/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@ def submit(self, func, *args, **kwargs):
except exceptions.ExecutionBlocked:
return futures.Future()

if isinstance(func, Activity):
task = self.make_activity_task(func, *args, **kwargs)
elif issubclass(func, Workflow):
task = self.make_workflow_task(func, *args, **kwargs)
else:
try:
if isinstance(func, Activity):
task = self.make_activity_task(func, *args, **kwargs)
elif issubclass(func, Workflow):
task = self.make_workflow_task(func, *args, **kwargs)
else:
raise TypeError
except TypeError:
raise TypeError('invalid type {} for {}'.format(
type(func), func))

Expand Down

0 comments on commit 8faa863

Please sign in to comment.