Skip to content

bpo-32327: Fix check for run_in_executor on closed loop#4996

Merged
asvetlov merged 1 commit into
python:masterfrom
asvetlov:drop-redunant-printout
Dec 23, 2017
Merged

bpo-32327: Fix check for run_in_executor on closed loop#4996
asvetlov merged 1 commit into
python:masterfrom
asvetlov:drop-redunant-printout

Conversation

@asvetlov

@asvetlov asvetlov commented Dec 23, 2017

Copy link
Copy Markdown
Contributor

Drop "run_in_executor was never awaited" message on tests run

https://bugs.python.org/issue32327

# but run_until_complete cannot be called on closed loop.
# Thus iterate once explicitly.
with self.assertRaises(RuntimeError):
it = self.loop.run_in_executor(None, func).__await__()

@1st1 1st1 Dec 23, 2017

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively

coro =  self.loop.run_in_executor(None, func)
self.loop.run_until_complete(coro)
coro.close()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.loop is closed, self.loop.run_until_complete() raises an exception before run_in_executor executing.

@1st1

1st1 commented Dec 23, 2017

Copy link
Copy Markdown
Member

I see. FWIW I don't see any point in having these tests at all, I'd just remove them.

Update: let's keep the tests, I didn't notice that there's was a .close() method call before those RuntimeError checks.

@asvetlov
asvetlov merged commit a330f48 into python:master Dec 23, 2017
@asvetlov
asvetlov deleted the drop-redunant-printout branch December 23, 2017 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants