Skip to content

Commit 280141c

Browse files
committed
Followed tiran changes review #1 recommendations
1 parent 1365fca commit 280141c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Lib/test/test_socket.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1747,13 +1747,13 @@ def testCreateISOTPSocket(self):
17471747
def testTooLongInterfaceName(self):
17481748
# most systems limit IFNAMSIZ to 16, take 1024 to be sure
17491749
with socket.socket(socket.PF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP) as s:
1750-
self.assertRaisesRegex(OSError, 'interface name too long',
1751-
s.bind, ('x' * 1024,1,2))
1750+
with self.assertRaisesRegex(OSError, 'interface name too long'):
1751+
s.bind(('x' * 1024,1,2))
17521752

17531753
def testBind(self):
17541754
try:
17551755
with socket.socket(socket.PF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP) as s:
1756-
addr = (self.interface,0x123,0x456)
1756+
addr = self.interface,0x123,0x456
17571757
s.bind(addr)
17581758
self.assertEqual(s.getsockname(), addr)
17591759
except OSError as e:

Modules/socketmodule.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
18821882
}
18831883
#endif
18841884

1885-
#if defined(AF_CAN)
1885+
#ifdef AF_CAN
18861886

18871887
#if defined(CAN_RAW) && defined(CAN_BCM)
18881888
case AF_CAN:
@@ -1929,7 +1929,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
19291929
}
19301930
#endif
19311931

1932-
#if defined(CAN_ISOTP)
1932+
#ifdef CAN_ISOTP
19331933
case CAN_ISOTP:
19341934
{
19351935
struct sockaddr_can *addr;
@@ -7055,9 +7055,10 @@ PyInit__socket(void)
70557055
PyModule_AddIntMacro(m, CAN_SFF_MASK);
70567056
PyModule_AddIntMacro(m, CAN_EFF_MASK);
70577057
PyModule_AddIntMacro(m, CAN_ERR_MASK);
7058-
7058+
#ifdef CAN_ISOTP
70597059
PyModule_AddIntMacro(m, CAN_ISOTP);
70607060
#endif
7061+
#endif
70617062
#ifdef HAVE_LINUX_CAN_RAW_H
70627063
PyModule_AddIntMacro(m, CAN_RAW_FILTER);
70637064
PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER);

0 commit comments

Comments
 (0)