Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-36802: Drop awrite()/aclose(), support await write() and await close() instead#13099

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
asvetlov merged 10 commits intopython:masterfromasvetlov:drop-awrite
May 9, 2019

Conversation

asvetlov
Copy link
Contributor

@asvetlovasvetlov commentedMay 5, 2019
edited by bedevere-bot
Loading

writelines() supports await syntax as well

https://bugs.python.org/issue36802

@asvetlovasvetlov requested a review fromgpshead as acode ownerMay 5, 2019 19:04
@asvetlov
Copy link
ContributorAuthor

The PR requires#13098
That's why I've merged that code to this branch.
I'm trying to keep PRs isolated but it is not always possible, sorry.

@gpsheadgpshead removed their request for reviewMay 5, 2019 20:30
return fut
if not self._protocol._paused:
return self._complete_fut
return self._loop.create_task(self.drain())
Copy link
Member

Choose a reason for hiding this comment

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

The idea is to avoid creating task in majority of the cases, e.g.:

In the stream__init__:

self._nop=self.loop.create_future()self._nop.set_result(None)

and then in_fast_drain:

ifnotself._paused:returnself._nop

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

But I do almost the same a few lines above.
There is nowriter._paused attribute butwriter._protocol._paused one (which has undefined state if the protocol is closing).
That's why I have slightly more comlex logic that you mentioned in a comment but the functionality is the same.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see, never mind. Could you please add a comment beforereturn self._complete_fut that it's a "fast path"?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done

@asvetlov
Copy link
ContributorAuthor

Is the PR good now?

@asvetlovasvetlov merged commita076e4f intopython:masterMay 9, 2019
@bedevere-bot
Copy link

@asvetlov: Please replace# withGH- in the commit message next time. Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@1st11st11st1 approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@asvetlov@bedevere-bot@1st1@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp