summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-11 01:03:25 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-07-11 01:03:25 +0200
commit76ca067cd7736f2e2ae6d1f300adc961203e2f87 (patch)
tree7e9d8fbbb1dfdfaab8a106a0d0a6e314e774aa56
parente65d26c8234754472393106ea015f5e8df5f8cef (diff)
downloadtrollius-76ca067cd7736f2e2ae6d1f300adc961203e2f87.tar.gz
CoroWrapper.__del__() now reuses repr(CoroWrapper) to log the "... was never
yielded from" warning
-rw-r--r--asyncio/coroutines.py3
-rw-r--r--tests/test_tasks.py2
2 files changed, 2 insertions, 3 deletions
diff --git a/asyncio/coroutines.py b/asyncio/coroutines.py
index 4cbfa85..3d3a19f 100644
--- a/asyncio/coroutines.py
+++ b/asyncio/coroutines.py
@@ -119,8 +119,7 @@ class CoroWrapper:
gen = getattr(self, 'gen', None)
frame = getattr(gen, 'gi_frame', None)
if frame is not None and frame.f_lasti == -1:
- func = events._format_callback(self.func, ())
- msg = 'Coroutine %s was never yielded from' % func
+ msg = '%r was never yielded from' % self
tb = getattr(self, '_source_traceback', ())
if tb:
tb = ''.join(traceback.format_list(tb))
diff --git a/tests/test_tasks.py b/tests/test_tasks.py
index b13818f..5029cfa 100644
--- a/tests/test_tasks.py
+++ b/tests/test_tasks.py
@@ -1653,7 +1653,7 @@ class TaskTests(test_utils.TestCase):
self.assertTrue(m_log.error.called)
message = m_log.error.call_args[0][0]
func_filename, func_lineno = test_utils.get_function_source(coro_noop)
- regex = (r'^Coroutine %s\(\) at %s:%s was never yielded from\n'
+ regex = (r'^<CoroWrapper %s\(\) .* at %s:%s, .*> was never yielded from\n'
r'Coroutine object created at \(most recent call last\):\n'
r'.*\n'
r' File "%s", line %s, in test_coroutine_never_yielded\n'