Skip to content

gh-157418: Correct the IocpProactor.recvfrom_into() parameter name - #157422

Merged
kumaraditya303 merged 2 commits into
python:mainfrom
lpyu001:asyncio-sock
Oct 19, 2026
Merged

kumaraditya303 merged 2 commits into
python:mainfrom
lpyu001:asyncio-sock

Conversation

@lpyu001

@lpyu001 lpyu001 commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

@picnixz

picnixz commented Sep 13, 2026

Copy link
Copy Markdown
Member

That's a breaking change strictly speaking. If we are not sure about how people are calling the APIs, we should be more careful.

@picnixz

picnixz commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Note that socket.recvfrom_into expects a flags not a number of bytes as its last parameter so I don't know what would be correct here (it's surprising that we don't have a flag anymore actually).

@picnixz

picnixz commented Sep 13, 2026

Copy link
Copy Markdown
Member

to be clear: I acknowledge this is a bug but I don't know if changing the parameter name is safe without a warning or whatever. Can you check the call sites and browse OSS repos?

@lpyu001

lpyu001 commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor Author

I couldn't find any OSS calls using IocpProactor.recvfrom_into(..., flags=...) as a keyword argument.

qasync overrides the method using the old flags name, but forwards the argument positionally:

def recvfrom_into(self, conn, buf, flags=0):
    return self._proactor.recvfrom_into(conn, buf, flags)

https://github.com/CabbageDevelopment/qasync/blob/master/src/qasync/_windows.py#L99-L101

CPython is unaffected because it has always treated the third argument as the receive length, rather than as actual socket flags:

return await self._proactor.recvfrom_into(sock, buf, nbytes)

https://github.com/python/cpython/blob/main/Lib/asyncio/proactor_events.py#L718-L720

@picnixz

picnixz commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Let's add a NEWS entry then just in case. This could trip people accidently and could be very annoying.

@lpyu001 lpyu001 changed the title gh-157418: Correct the IocpProactor recvfrom_into parameter name gh-157418: Correct the IocpProactor.recvfrom_into() parameter name Sep 14, 2026
@lpyu001

lpyu001 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Hi, @kumaraditya303 do you have any comments or suggestions regarding this change?

@lpyu001

lpyu001 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

cc @agronholm

@agronholm

Copy link
Copy Markdown
Contributor

Why did you tag me here?

@lpyu001

lpyu001 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Why did you tag me here?

I see this is your code.

@kumaraditya303
kumaraditya303 merged commit ac42dc4 into python:main Oct 19, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants