Uh oh!
There was an error while loading. Please reload this page.
bpo-40007: Make asyncio.transport.writelines on selector use sendmsg - #19062
bpo-40007: Make asyncio.transport.writelines on selector use sendmsg#19062tzickel wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Thanks for the PR @tzickel.
Assuming the general idea is approved of by Yury and/or Andrew, this PR will likely need to include a unit test that ensures it behaves as expected; it would be best included in Lib/test/test_asyncio/test_selector_events.py. See the existing transport tests in there for examples, such as the ones that start with test_write*.
The PR could also use a Misc/NEWS entry to briefly explain the changes.
In the meantime, I have a few suggestions/general comments:
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Also, the current CI failures will have to be addressed of course. My comments above were just concerns that I noticed at a glance. I suspect that some of the failures may have been occurring as a result of the |
tzickel
commented
Mar 19, 2020
@aeros Thanks for your comments, I've hopefully fixed the code / logic mistakes. |
aeros
commented
Mar 20, 2020
I wasn't referring to repeating the Current: sendmsg=getattr(socket.socket, "sendmsg", False)
# [snip]defwritelines(self, lines):
ifnotsendmsg:
returnself.write(b''.join(lines))
# [snip]Recommended: # Used to determine if platform supports sendmsg to sockets# [_NAME is our typical convention for internal globals, to differentiate it]_SENDMSG=Noneclass_SelectorSocketTransport(_SelectorTransport):
# [snip]def__init__(self, loop, sock, protocol, waiter=None,
extra=None, server=None):
global_SENDMSG# [ensures the `getattr()` is only done once, but doesn't create extra# overhead when select_events is imported]if_SENDMSGisNone:
_SENDMSG=getattr(socket.socket, "sendmsg", False)
self._sendmsg=_SENDMSG# [snip]defwritelines(self, lines):
ifnotself._sendmsg:
returnself.write(b''.join(lines))
# [snip]Does that make it more clear? |
Also, as a side note, there's typically no need to force push over old commits for PR branches in the CPython repo since we squash prior to merging. It can occasionally help if it the history becomes muddled over time, but it can also make changes made to the PR harder to follow for review purposes. See https://discuss.python.org/t/pep-601-forbid-return-break-continue-breaking-out-of-finally/2239/42. It's also mentioned at the end of https://devguide.python.org/pullrequest/#submitting. |
asvetlov
commented
Mar 17, 2022
#31871 is the newer resurrection of the idea. |
https://bugs.python.org/issue40007