From 2372e2cfc0c7ad6420b323b9712fdc1604da00f8 Mon Sep 17 00:00:00 2001 From: Alex DeLorenzo <3579286+alexdelorenzo@users.noreply.github.com> Date: Wed, 19 May 2021 01:01:37 -0400 Subject: [PATCH 1/3] Use inspect.isawaitable() to detect if as_completed()'s first param is awaitable --- Lib/asyncio/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index 52f1e6629e2fc6..807c27713588f0 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -543,7 +543,7 @@ def as_completed(fs, *, timeout=None): Note: The futures 'f' are not necessarily members of fs. """ - if futures.isfuture(fs) or coroutines.iscoroutine(fs): + if futures.isfuture(fs) or inspect.isawaitable(fs): raise TypeError(f"expect an iterable of futures, not {type(fs).__name__}") from .queues import Queue # Import here to avoid circular import problem. From e962f2055b9289f117ab1a70bd42e9478cc1be08 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 2 Jun 2021 03:12:45 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2021-06-02-03-12-44.bpo-44176.-9OGEL.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2021-06-02-03-12-44.bpo-44176.-9OGEL.rst diff --git a/Misc/NEWS.d/next/Library/2021-06-02-03-12-44.bpo-44176.-9OGEL.rst b/Misc/NEWS.d/next/Library/2021-06-02-03-12-44.bpo-44176.-9OGEL.rst new file mode 100644 index 00000000000000..1a108917f83ac5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-06-02-03-12-44.bpo-44176.-9OGEL.rst @@ -0,0 +1 @@ +Use ``inspect.isawaitable()`` to detect if ``as_completed()``'s first parameter is awaitable \ No newline at end of file From f75ef19afe67a9656c1bd3b80ca37ac2a555b30e Mon Sep 17 00:00:00 2001 From: alexdelorenzo Date: Wed, 2 Jun 2021 19:44:04 -0400 Subject: [PATCH 3/3] Use inspect.isawaitable() to detect if wait()'s first parameter is awaitable --- Lib/asyncio/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index ecc2d333ffce56..ae6bf5d35f0f8a 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -362,7 +362,7 @@ async def wait(fs, *, timeout=None, return_when=ALL_COMPLETED): Note: This does not raise TimeoutError! Futures that aren't done when the timeout occurs are returned in the second set. """ - if futures.isfuture(fs) or coroutines.iscoroutine(fs): + if futures.isfuture(fs) or inspect.isawaitable(fs): raise TypeError(f"expect a list of futures, not {type(fs).__name__}") if not fs: raise ValueError('Set of coroutines/Futures is empty.') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy