Skip to content

Commit

Permalink
Followed tiran changes review #1 recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
pylessard committed Aug 26, 2017
1 parent 1365fca commit 280141c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1747,13 +1747,13 @@ def testCreateISOTPSocket(self):
def testTooLongInterfaceName(self):
# most systems limit IFNAMSIZ to 16, take 1024 to be sure
with socket.socket(socket.PF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP) as s:
self.assertRaisesRegex(OSError, 'interface name too long',
s.bind, ('x' * 1024,1,2))
with self.assertRaisesRegex(OSError, 'interface name too long'):
s.bind(('x' * 1024,1,2))

def testBind(self):
try:
with socket.socket(socket.PF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP) as s:
addr = (self.interface,0x123,0x456)
addr = self.interface,0x123,0x456
s.bind(addr)
self.assertEqual(s.getsockname(), addr)
except OSError as e:
Expand Down
7 changes: 4 additions & 3 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
}
#endif

#if defined(AF_CAN)
#ifdef AF_CAN

#if defined(CAN_RAW) && defined(CAN_BCM)
case AF_CAN:
Expand Down Expand Up @@ -1929,7 +1929,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
}
#endif

#if defined(CAN_ISOTP)
#ifdef CAN_ISOTP
case CAN_ISOTP:
{
struct sockaddr_can *addr;
Expand Down Expand Up @@ -7055,9 +7055,10 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, CAN_SFF_MASK);
PyModule_AddIntMacro(m, CAN_EFF_MASK);
PyModule_AddIntMacro(m, CAN_ERR_MASK);

#ifdef CAN_ISOTP
PyModule_AddIntMacro(m, CAN_ISOTP);
#endif
#endif
#ifdef HAVE_LINUX_CAN_RAW_H
PyModule_AddIntMacro(m, CAN_RAW_FILTER);
PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER);
Expand Down

0 comments on commit 280141c

Please sign in to comment.