Skip to content
1 change: 1 addition & 0 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,7 @@ def testCreateBCMSocket(self):
def testBindAny(self):
with socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) as s:
s.bind(('', ))
self.assertIsInstance(s.getsockname(), tuple)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to make the more specific assertion here that s.getsockname() == ('',)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so, even though it isn't the greatest of tests to begin with. I'll make the change anyway.


def testTooLongInterfaceName(self):
# most systems limit IFNAMSIZ to 16, take 1024 to be sure
Expand Down
2 changes: 1 addition & 1 deletion Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ makesockaddr(SOCKET_T sockfd, struct sockaddr *addr, size_t addrlen, int proto)
#endif /* CAN_ISOTP */
default:
{
return Py_BuildValue("O&", PyUnicode_DecodeFSDefault,
return Py_BuildValue("(O&)", PyUnicode_DecodeFSDefault,
ifname);
}
}
Expand Down