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
socket.getsockname() returns string instead of tuple #81586
Comments
In Python 3.5.3, a socket with type AF_CAN returns a tuple in the form Example: #3.5.3
import socket
s = socket.socket(socket.AF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
s.bind(('vcan0',)) # requires tuple
s.getsockname() # returns tuple: ('vcan0', 29)
#3.7.3
import socket
s = socket.socket(socket.AF_CAN, socket.SOCK_RAW, socket.CAN_RAW)
s.bind(('vcan0',)) # requires tuple
s.getsockname() # returns string: 'vcan0' |
Changed caused by commit effc12f to cpython/Modules/socketmodule.c on Sep 6, 2017. |
Correction, change caused by a30f6d4 to cpython/Modules/socketmodule.c on Aug 28, 2017. |
$ make test TESTOPTS="-v test_socket" ERROR: testSendFrame (main.CANTest) Traceback (most recent call last):
File "/s/opt/cpython/debug/test_socket.py", line 2052, in testSendFrame
self.assertEqual(addr[1], socket.AF_CAN)
IndexError: tuple index out of range $ cat ../.git/config
https://github.com/bennett78/cpython.git
$ uname -r
5.4.0-67-genericg$ cat /etc/issue
Ubuntu 20.04.2 LTS \n \l
$ /s/opt/cpython/debug$ ./python -V
Python 3.10.0a6+ |
This test was overlooked, and line 2052 should now be removed per the discussion here: In short, getsockname() used to return |
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: