Skip to content

bpo-40124: Explain an assert when waiting on a asyncio stream drain #19240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

pgjones
Copy link
Contributor

@pgjones pgjones commented Mar 31, 2020

If a task is waiting on a stream to drain and another task tries to
this assertion will fail. It wasn't clear at first glance why the
assertion failed, but I hope with this message it will be.

https://bugs.python.org/issue40124

If a task is waiting on a stream to drain and another task tries to
this assertion will fail. It wasn't clear at first glance why the
assertion failed, but I hope with this message it will be.
Copy link
Member

@cjerdonek cjerdonek left a comment

Choose a reason for hiding this comment

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

Thanks for your PR! Can you also--

  1. Add your name to the ACKS file
  2. Add a NEWS entry with "Patch by " at the end: https://devguide.python.org/committing/#what-s-new-and-news-entries

@@ -191,7 +191,9 @@ async def _drain_helper(self):
if not self._paused:
return
waiter = self._drain_waiter
assert waiter is None or waiter.cancelled()
assert waiter is None or waiter.cancelled(), (
'Another task is waiting for this stream to drain'
Copy link
Member

Choose a reason for hiding this comment

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

I think this would be a little clearer if it said, "Another task is already waiting for this stream to drain"

Copy link
Member

Choose a reason for hiding this comment

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

I'd make it a proper check too.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

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.

8 participants