Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Followed tiran changes review #1 recommendations
  • Loading branch information
pylessard committed Aug 26, 2017
commit 280141c99b81411cd000bb61391a9c39935901c6
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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs a #ifdef 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