-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Support async recvmsg and sendmsg
#114857
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
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only skimmed this, but it looks pretty straightforward (it's just a clone of recvfrom/sendto). I'm still skeptical how much use this would get (the Discourse thread has some folks stating it'd be useful for them, but not a lot). I'm also skeptical that you couldn't easily provide this as a pair of user-level coroutines (yeah, I tried in the Discourse thread and failed, but if this could be a small 3rd party library, it'd take some maintenance off our hands -- asyncio is understaffed as it is).
(@Eclips4 Do you have interest in this yourself or did you just think that this is ready to be promoted from Draft?)
Lib/asyncio/selector_events.py
Outdated
| if self._debug and sock.gettimeout() != 0: | ||
| raise ValueError("the socket must be non-blocking") | ||
| try: | ||
| return sock.recvfrom(bufsize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this use recvmsg? (TBH I don't know anything about recvmsg so I may be missing something. But it looks to me like a simple copy-and-paste bug.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad.
The whole file had a lot of copy-and-paste code already before.
I would love to reduce the code duplications in that module. But probably I will not manage to find time for it.
|
Targeting the branch of an already released version is probably a nonstarter for a new feature? Should almost certainly be targeting main. |
8963a9d to
d13ffee
Compare
d13ffee to
cc88bac
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
cc88bac to
ee826c3
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
ee826c3 to
fe97e24
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
fe97e24 to
f92c8cc
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
All in all, these methods are not the most commonly used, but if one needs to use them, they still can using the |
Hm. It would be the addition of a small amount of pretty standard boilerplate to uvloop, right? Just clone the existing copy for @LukasWoodtli What do you think? |
f92c8cc to
5f7d457
Compare
5f7d457 to
3e421fe
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
I'm a bit undecided about how to proceed with this PR. |
|
I am interested in seeing this merged. It's a pretty general need that's not bespoke to one downstream project. For example, it's needed to be able to use e.g. |
async
recvmsgandsendmsgFollowing the discussion here: https://discuss.python.org/t/expanding-asyncio-support-for-socket-apis/19277
Implemented async variants of:
loop.sock_sendmsg- async analogue ofsocket.sendmsgloop.sock_recvmsg- async analogue ofsocket.sock_recvmsgThis is a draft PR open for discussion.
Some open tasks for this draft: