closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392)

This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
This commit is contained in:
bggardner 2019-09-12 06:02:48 -04:00 committed by Benjamin Peterson
parent 64535fc6c0
commit 954900a3f9
3 changed files with 6 additions and 2 deletions

View file

@ -1948,7 +1948,9 @@ class BasicCANTest(unittest.TestCase):
def testBindAny(self):
with socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) as s:
s.bind(('', ))
address = ('', )
s.bind(address)
self.assertEqual(s.getsockname(), address)
def testTooLongInterfaceName(self):
# most systems limit IFNAMSIZ to 16, take 1024 to be sure