Skip to content

socket.getaddrinfo Py3.10 docs say "AddressFamily.SOCK_STREAM" #98026

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

Open
alexdutton opened this issue Oct 7, 2022 · 2 comments
Open

socket.getaddrinfo Py3.10 docs say "AddressFamily.SOCK_STREAM" #98026

alexdutton opened this issue Oct 7, 2022 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@alexdutton
Copy link

Documentation

The socket.getaddrinfo example in the Py3.10 docs is given as the following:

>>> socket.getaddrinfo("example.org", 80, proto=socket.IPPROTO_TCP)
[(<AddressFamily.AF_INET6: 10>, <AddressFamily.SOCK_STREAM: 1>,
 6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),
 (<AddressFamily.AF_INET: 2>, <AddressFamily.SOCK_STREAM: 1>,
 6, '', ('93.184.216.34', 80))]

This should have SocketKind instead of the second AddressFamily:

>>> socket.getaddrinfo("example.org", 80, proto=socket.IPPROTO_TCP)
[(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>,
 6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),
 (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>,
 6, '', ('93.184.216.34', 80))]

I've checked the main, 3.10 and 3.11 branches, and this is only apparent in the 3.10 documentation. The main and 3.11 branches have older lines here and use the module-level constants. I wouldn't know where to direct a PR, sorry.

@alexdutton alexdutton added the docs Documentation in the Doc dir label Oct 7, 2022
@mmmarcos
Copy link

Actually, displaying the module name (socket.SOCK_STREAM) instead of the enumeration name (SocketKind.SOCK_STREAM) seem to be the newly (3.11?) expected behavior, see #84247 and #22392.
Docs have been updated in b775106.

@mmmarcos
Copy link

However both 3.10.7 and 3.11.0rc2 return:

>>> socket.getaddrinfo("example.org", 80, proto=socket.IPPROTO_TCP)
[(<AddressFamily.AF_INET6: 10>, <SocketKind.SOCK_STREAM: 1>, 
6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)), 
(<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 
6, '', ('93.184.216.34', 80))]

If this is the expected behavior, I guess both 3.10 and 3.11 will need a fix in the docs (maybe @ethanfurman can confirm?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants