commit | 95728982825e1c7247d40e8cfcae48b46377baa6 | [log] [tgz] |
---|---|---|
author | Victor Stinner <victor.stinner@gmail.com> | Thu Jan 30 16:01:54 2014 -0800 |
committer | Victor Stinner <victor.stinner@gmail.com> | Thu Jan 30 16:01:54 2014 -0800 |
tree | 9119d9fd73c18e06a7e5c7a9cac54acdb71af1c8 | |
parent | 91445fbeb05f77551a8f83c5188362093916b0e1 [diff] [blame] |
asyncio: Future.set_exception(exc) should instantiate exc if it is a class.
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 9ee13e3..d09f423 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py
@@ -301,6 +301,8 @@ """ if self._state != _PENDING: raise InvalidStateError('{}: {!r}'.format(self._state, self)) + if isinstance(exception, type): + exception = exception() self._exception = exception self._state = _FINISHED self._schedule_callbacks()