diff options
| author | Yury Selivanov <yselivanov@sprymix.com> | 2015-12-11 11:33:59 -0500 | 
|---|---|---|
| committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-12-11 11:33:59 -0500 | 
| commit | 0ac3a0cd7932079724aaabbb0a078e1c17129068 (patch) | |
| tree | 5aa52402d3fde41233b91ca88a04c03d6d6ed343 /Lib/asyncio/tasks.py | |
| parent | dddc781998da741511178c7cb4e303e3db5aac45 (diff) | |
| download | cpython-git-0ac3a0cd7932079724aaabbb0a078e1c17129068.tar.gz | |
asyncio: Make Tasks check if Futures are attached to the same event loop
See https://github.com/python/asyncio/pull/303 for details
Diffstat (limited to 'Lib/asyncio/tasks.py')
| -rw-r--r-- | Lib/asyncio/tasks.py | 8 | 
1 files changed, 7 insertions, 1 deletions
| diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index e6389d82bd..a2ab8815b6 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -251,7 +251,13 @@ class Task(futures.Future):          else:              if isinstance(result, futures.Future):                  # Yielded Future must come from Future.__iter__(). -                if result._blocking: +                if result._loop is not self._loop: +                    self._loop.call_soon( +                        self._step, +                        RuntimeError( +                            'Task {!r} got Future {!r} attached to a ' +                            'different loop'.format(self, result))) +                elif result._blocking:                      result._blocking = False                      result.add_done_callback(self._wakeup)                      self._fut_waiter = result | 
