This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
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
--- /dev/null
+Fixed regression bug for socket.getsockname() for non-CAN_ISOTP AF_CAN
+address family sockets by returning a 1-tuple instead of string.
#endif /* CAN_ISOTP */
default:
{
- return Py_BuildValue("O&", PyUnicode_DecodeFSDefault,
+ return Py_BuildValue("(O&)", PyUnicode_DecodeFSDefault,
ifname);
}
}