bpo-33584: Fix several minor bugs in asyncio. (GH-7003) (GH-7005)

Fix the following bugs in the C implementation:

* get_future_loop() silenced all exceptions raised when look up the get_loop
  attribute, not just an AttributeError.
* enter_task() silenced all exceptions raised when look up the current task,
  not just a KeyError.
* repr() was called for a borrowed link in enter_task() and task_step_impl().
* str() was used instead of repr() in formatting one error message (in
  Python implementation too).
* There where few reference leaks in error cases.
(cherry picked from commit 6655354afc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-05-20 07:34:28 -07:00 committed by Serhiy Storchaka
parent 28ea38b97b
commit 52d1741c95
2 changed files with 22 additions and 16 deletions

View file

@ -261,7 +261,7 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
# Yielding a generator is just wrong.
new_exc = RuntimeError(
f'yield was used instead of yield from for '
f'generator in task {self!r} with {result}')
f'generator in task {self!r} with {result!r}')
self._loop.call_soon(
self.__step, new_exc, context=self._context)
else: