New submission from Matt Johnston:

asyncio.Event.wait() doesn't seem to be cancelled by asyncio.wait_for(). Ctrl-c 
in the attached example produces output below. I'm not certain the code is 
correct though the documentation for wait_for() suggests it should work. 
Without the wait_for() it doesn't suffer from pending task destruction. This is 
Python 3.4.3. 


Hello World!
Hello World!
^CTraceback (most recent call last):
  File "./loop2.py", line 27, in <module>
    loop.run_until_complete(hello_world())
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py",
 line 304, in run_until_complete
    self.run_forever()
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py",
 line 276, in run_forever
    self._run_once()
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py",
 line 1136, in _run_once
    event_list = self._selector.select(timeout)
  File 
"/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/selectors.py", 
line 502, in select
    kev_list = self._kqueue.control(None, max_ev, timeout)
KeyboardInterrupt
Task was destroyed but it is pending!
task: <Task pending coro=<wait() running at 
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/locks.py:242>
 wait_for=<Future pending cb=[Task._wakeup()]> cb=[_release_waiter(<Future 
pendi...sk._wakeup()]>)() at 
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py:335]>
[1]    8134 exit 1     ../venv3/bin/python3 ./loop2.py

----------
components: asyncio
files: loop2.py
messages: 242269
nosy: gvanrossum, haypo, matt, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.Event.wait() Task was destroyed but it is pending
versions: Python 3.4
Added file: http://bugs.python.org/file39234/loop2.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24080>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to