summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-11-09 00:57:44 (GMT)
committerYury Selivanov <yury@magic.io>2016-11-09 00:57:44 (GMT)
commitc0215dfbc1156267e3b14145c49195c843cd0721 (patch)
tree0f053a6c2ff098ba508f7725c4685e3ceabef727 /Lib/inspect.py
parent33499b7eed8a0c719636dba4b5727246cf2ffa9a (diff)
downloadcpython-c0215dfbc1156267e3b14145c49195c843cd0721.zip
cpython-c0215dfbc1156267e3b14145c49195c843cd0721.tar.gz
cpython-c0215dfbc1156267e3b14145c49195c843cd0721.tar.bz2
Issue #28639: Fix inspect.isawaitable to always return bool
Patch by Justin Mayfield.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 0fd0382..e6dae1e 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -207,10 +207,10 @@ def iscoroutine(object):
return isinstance(object, types.CoroutineType)
def isawaitable(object):
- """Return true is object can be passed to an ``await`` expression."""
+ """Return true if object can be passed to an ``await`` expression."""
return (isinstance(object, types.CoroutineType) or
isinstance(object, types.GeneratorType) and
- object.gi_code.co_flags & CO_ITERABLE_COROUTINE or
+ bool(object.gi_code.co_flags & CO_ITERABLE_COROUTINE) or
isinstance(object, collections.abc.Awaitable))
def istraceback(object):