[Python-checkins] cpython (merge 3.5 -> 3.6): Merge 3.5 (issue #28639)

yury.selivanov python-checkins at python.org
Tue Nov 8 20:00:12 EST 2016


https://hg.python.org/cpython/rev/6540adb8722a
changeset:   105002:6540adb8722a
branch:      3.6
parent:      104999:9f32ef6b210b
parent:      105001:bb6ad816a43c
user:        Yury Selivanov <yury at magic.io>
date:        Tue Nov 08 19:59:29 2016 -0500
summary:
  Merge 3.5 (issue #28639)

files:
  Lib/inspect.py |  4 ++--
  Misc/NEWS      |  3 +++
  2 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Lib/inspect.py b/Lib/inspect.py
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -219,10 +219,10 @@
     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):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -40,6 +40,9 @@
 
 - Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw.
 
+- Issue #28639: Fix inspect.isawaitable to always return bool
+  Patch by Justin Mayfield.
+
 Documentation
 -------------
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list