diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-06-30 18:19:18 -0400 |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-06-30 18:19:18 -0400 |
commit | 93a3252c9c656c095e6855e48c1d05eda141be09 (patch) | |
tree | 885ba2eec33a194830960ab0eff55d53dbb870b8 | |
parent | b2c42c2a8f308626bba43db31a78907bf6e07dc3 (diff) | |
parent | a74b5e59af6b4271eac7953771e7d3346e76b058 (diff) | |
download | cpython-git-93a3252c9c656c095e6855e48c1d05eda141be09.tar.gz |
Merge 3.5 (Issue #24400)
-rw-r--r-- | Doc/library/inspect.rst | 10 | ||||
-rw-r--r-- | Doc/whatsnew/3.5.rst | 5 | ||||
-rw-r--r-- | Lib/inspect.py | 4 | ||||
-rw-r--r-- | Lib/test/test_inspect.py | 25 |
4 files changed, 2 insertions, 42 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index d4ebffd584..8bce5223f8 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -303,16 +303,6 @@ attributes: .. versionadded:: 3.5 -.. function:: isawaitable(object) - - Return true if the object can be used in :keyword:`await` - expression. - - See also :class:`collections.abc.Awaitable`. - - .. versionadded:: 3.5 - - .. function:: istraceback(object) Return true if the object is a traceback. diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index abc1b8db6e..63a5ff53d8 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -527,9 +527,8 @@ inspect * New argument ``follow_wrapped`` for :func:`inspect.signature`. (Contributed by Yury Selivanov in :issue:`20691`.) -* New :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, - and :func:`~inspect.isawaitable` functions. (Contributed by Yury Selivanov - in :issue:`24017`.) +* New :func:`~inspect.iscoroutine` and :func:`~inspect.iscoroutinefunction` + functions. (Contributed by Yury Selivanov in :issue:`24017`.) * New :func:`~inspect.getcoroutinelocals` and :func:`~inspect.getcoroutinestate` functions. (Contributed by Yury Selivanov in :issue:`24400`.) diff --git a/Lib/inspect.py b/Lib/inspect.py index 6285a6cdd5..f48769e514 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -186,10 +186,6 @@ def iscoroutinefunction(object): return bool((isfunction(object) or ismethod(object)) and object.__code__.co_flags & CO_COROUTINE) -def isawaitable(object): - """Return true if the object can be used in "await" expression.""" - return isinstance(object, collections.abc.Awaitable) - def isgenerator(object): """Return true if the object is a generator. diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 39fa484abc..ebd106c1d7 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -159,31 +159,6 @@ class TestPredicates(IsTestBase): coro.close(); gen_coro.close() # silence warnings - def test_isawaitable(self): - def gen(): yield - self.assertFalse(inspect.isawaitable(gen())) - - coro = coroutine_function_example(1) - gen_coro = gen_coroutine_function_example(1) - - self.assertTrue( - inspect.isawaitable(coro)) - self.assertTrue( - inspect.isawaitable(gen_coro)) - - class Future: - def __await__(): - pass - self.assertTrue(inspect.isawaitable(Future())) - self.assertFalse(inspect.isawaitable(Future)) - - class NotFuture: pass - not_fut = NotFuture() - not_fut.__await__ = lambda: None - self.assertFalse(inspect.isawaitable(not_fut)) - - coro.close(); gen_coro.close() # silence warnings - def test_isroutine(self): self.assertTrue(inspect.isroutine(mod.spam)) self.assertTrue(inspect.isroutine([].count)) |