Author Brent Gardner
Recipients Brent Gardner, docs@python
Date 2019-06-25.21:01:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561496477.42.0.179203753139.issue37405@roundup.psfhosted.org>
In-reply-to
Content
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'
History
Date User Action Args
2019-06-25 21:01:17Brent Gardnersetrecipients: + Brent Gardner, docs@python
2019-06-25 21:01:17Brent Gardnersetmessageid: <1561496477.42.0.179203753139.issue37405@roundup.psfhosted.org>
2019-06-25 21:01:17Brent Gardnerlinkissue37405 messages
2019-06-25 21:01:17Brent Gardnercreate