mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
Issue #28639: Fix inspect.isawaitable to always return bool
Patch by Justin Mayfield.
This commit is contained in:
parent
33499b7eed
commit
c0215dfbc1
2 changed files with 5 additions and 2 deletions
|
|
@ -207,10 +207,10 @@ def iscoroutine(object):
|
||||||
return isinstance(object, types.CoroutineType)
|
return isinstance(object, types.CoroutineType)
|
||||||
|
|
||||||
def isawaitable(object):
|
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
|
return (isinstance(object, types.CoroutineType) or
|
||||||
isinstance(object, types.GeneratorType) and
|
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))
|
isinstance(object, collections.abc.Awaitable))
|
||||||
|
|
||||||
def istraceback(object):
|
def istraceback(object):
|
||||||
|
|
|
||||||
|
|
@ -450,6 +450,9 @@ Library
|
||||||
- Issue #28613: Fix get_event_loop() return the current loop if
|
- Issue #28613: Fix get_event_loop() return the current loop if
|
||||||
called from coroutines/callbacks.
|
called from coroutines/callbacks.
|
||||||
|
|
||||||
|
- Issue #28639: Fix inspect.isawaitable to always return bool
|
||||||
|
Patch by Justin Mayfield.
|
||||||
|
|
||||||
IDLE
|
IDLE
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue