bpo-39010: Ignore error on cancelled future after end of loop. #20525
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Python 3.8+ outputs spurious error messages for any
asyncio.run_forever
call with pendingrun_in_executor
calls when it finishes. When used in a loop that single steps through asyncio usingloop.stop()
followed byloop.run_forever()
, there are repeated, useless error messages. The spurious error messages cannot be prevented in any way I can find.This patch prevents these spurious error messages. The proactor and windows event code probably needs broader improvements to manage its state properly at exit. This patch does not deal with the broader issue. This patch is only a stop-gap to make Python 3.8 usable by our users.
The bug is easily reproduced with the following code (Windows only). I could not make a test case which would fail on the error since the exception is handled (and output) in low level code.
https://bugs.python.org/issue39010