changeset: 105002:6540adb8722a branch: 3.6 parent: 104999:9f32ef6b210b parent: 105001:bb6ad816a43c user: Yury Selivanov date: Tue Nov 08 19:59:29 2016 -0500 files: Lib/inspect.py Misc/NEWS description: Merge 3.5 (issue #28639) diff -r 9f32ef6b210b -r 6540adb8722a Lib/inspect.py --- a/Lib/inspect.py Tue Nov 08 19:46:22 2016 -0500 +++ b/Lib/inspect.py Tue Nov 08 19:59:29 2016 -0500 @@ -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 -r 9f32ef6b210b -r 6540adb8722a Misc/NEWS --- a/Misc/NEWS Tue Nov 08 19:46:22 2016 -0500 +++ b/Misc/NEWS Tue Nov 08 19:59:29 2016 -0500 @@ -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 -------------