closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392) (GH-16018)
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
(cherry picked from commit 954900a3f98a8c0dea14dd575490237f3f8626b3)
Co-authored-by: bggardner <brent@ebrent.net>
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index c472be1..1bf562a 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1897,7 +1897,9 @@
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