STINNER Victor added the comment:

I fixed the first "Task was destroyed but it is pending!" messages when the fix 
was simple.

Attached dont_log_pending.patch fixes remaining messages when running 
test_asyncio. I'm not sure yet that this patch is the best approach to fix the 
issue.


Modified functions with example of related tests:


* BaseEventLoop.run_until_complete(): don't log because there the method 
already raises an exception if the future didn't complete ("Event loop stopped 
before Future completed.")

=> related test: test_run_until_complete_stopped() of test_events.py


* wait(): don't log because the caller doesn't have control on the internal 
sub-tasks, and the task executing wait() will already emit a message if it is 
destroyed whereas it didn't completed

=> related test: test_wait_errors() of test_tasks.py


* gather(): same rationale than wait()

=> related test: test_one_exception() of test_tasks.py


* test_utils.run_briefly(): the caller doesn't have access to the task and the 
function is a best effort approach, it doesn't have to guarantee that running a 
step of the event loop is until to execute all pending callbacks

=> related test: test_baseexception_during_cancel() of test_tasks.py

----------
Added file: http://bugs.python.org/file35781/dont_log_pending.patch

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

Reply via email to