This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author njs
Recipients asvetlov, njs, vitaly.krug, yselivanov
Date 2018-03-27.00:55:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522112118.77.0.467229070634.issue33148@psf.upfronthosting.co.za>
In-reply-to
Content
Yeah, getaddrinfo isn't actually cancellable (because it's a blocking call that has to be run in a thread), but it's side-effect-free so if the user requests that it be cancelled then it's safe to return immediately while it keeps running in the background, and asyncio does so. But if we've already decided to discard the result then it's better to do that silently, like you say.

When trio hits this case, it does silently throw away the result: https://github.com/python-trio/trio/blob/aebb42888dd0978c3b74f8c9cdf8aec2ce2cbd73/trio/_threads.py#L372-L377
It's a little bit more obvious in trio's case because there we 100% know that if the call to `trio.run` has finished, then there's no-one listening for the result, and that the user has explicitly requested this behavior. In asyncio's case, I guess in *theory* someone could still be hoping the Future's done callback will be invoked even after the loop is closed. This seems unlikely though... and in general when the loop is closed then every other registered callback is silently discarded, so doing that for run_in_executor seems fine too.
History
Date User Action Args
2018-03-27 00:55:18njssetrecipients: + njs, asvetlov, yselivanov, vitaly.krug
2018-03-27 00:55:18njssetmessageid: <1522112118.77.0.467229070634.issue33148@psf.upfronthosting.co.za>
2018-03-27 00:55:18njslinkissue33148 messages
2018-03-27 00:55:17njscreate