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
Don't refer to getsockaddrarg in error messages #74018
Comments
getsockaddrarg() is an internal C function in the socket module implementation used in a number of socket methods (bind(), connect(), connect_ex(), sendto(), sendmsg()) for creating C structure sock_addr_t from Python tuple. Error messages raised when pass incorrect socket address argument to these function contain the name "getsockaddrarg" despite the fact that it is not directly exposed at Python level, nor the name of standard C function. >>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.bind(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: getsockaddrarg: AF_INET address must be tuple, not int
>>> s.bind(())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: getsockaddrarg() takes exactly 2 arguments (0 given) I think that error messages shouldn't refer to non-existing function "getsockaddrarg()". This issue is a part of more general bpo-28261. |
note that bpo-15988 also left 3 changes for this issue to fix, as can be for example, this issue should also fix the following inconsistent
error messages:
>>> socket.socket(family=socket.AF_INET6).bind(('::1', -1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: getsockaddrarg: port must be 0-65535.
>>> socket.socket(family=socket.AF_INET6).bind(('::1', -1 << 1000))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long |
here is a dirty script to test my PR. the script contains tests to anything I managed to test using my |
Should i remove the code that i wasn't able to test from the PR, and (of course, if there is some way i can do it using a VM, please point |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: