X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/df1c86cbe7cf0727d81e526e904b0752d7371da0..4f1772e2aed8356e57b923eacf45f813ec3324a0:/src/black/concurrency.py?ds=sidebyside diff --git a/src/black/concurrency.py b/src/black/concurrency.py index 69d79f5..24f67b6 100644 --- a/src/black/concurrency.py +++ b/src/black/concurrency.py @@ -42,9 +42,12 @@ def shutdown(loop: asyncio.AbstractEventLoop) -> None: for task in to_cancel: task.cancel() - loop.run_until_complete( - asyncio.gather(*to_cancel, loop=loop, return_exceptions=True) - ) + if sys.version_info >= (3, 7): + loop.run_until_complete(asyncio.gather(*to_cancel, return_exceptions=True)) + else: + loop.run_until_complete( + asyncio.gather(*to_cancel, loop=loop, return_exceptions=True) + ) finally: # `concurrent.futures.Future` objects cannot be cancelled once they # are already running. There might be some when the `shutdown()` happened.