Message346559
In Python 3.5.3, a socket with type AF_CAN returns a tuple in the form `(interface, )` from getsockname(). In Python 3.7.3, getsockname() returns a string (the name of the interface). The documentation states "a tuple is used for the AF_CAN address family". The string will break code that worked in 3.5.3 by raising errors such as "Value Error: too many values to unpack (expected 2)".
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' |
|
Date |
User |
Action |
Args |
2019-06-25 21:01:17 | Brent Gardner | set | recipients:
+ Brent Gardner, docs@python |
2019-06-25 21:01:17 | Brent Gardner | set | messageid: <1561496477.42.0.179203753139.issue37405@roundup.psfhosted.org> |
2019-06-25 21:01:17 | Brent Gardner | link | issue37405 messages |
2019-06-25 21:01:17 | Brent Gardner | create | |
|