Skip to content

Commit

Permalink
Improved is_future check (more performant).
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Aug 18, 2016
1 parent 480040a commit 4ef0a69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion promise/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def handle_future_result(future):


def is_future(obj):
return hasattr(obj, "add_done_callback") and callable(getattr(obj, "add_done_callback"))
return callable(getattr(obj, "add_done_callback", None))


def is_thenable(obj):
Expand Down

0 comments on commit 4ef0a69

Please sign in to comment.