Fix tests in test_socket to use correctly CMSG_LEN (GH-9594) · python/cpython@7291108 (original) (raw)

Original file line number Diff line number Diff line change
@@ -3223,10 +3223,11 @@ def _testFDPassSeparate(self):
3223 3223 def testFDPassSeparateMinSpace(self):
3224 3224 # Pass two FDs in two separate arrays, receiving them into the
3225 3225 # minimum space for two arrays.
3226 -self.checkRecvmsgFDs(2,
3226 +num_fds = 2
3227 +self.checkRecvmsgFDs(num_fds,
3227 3228 self.doRecvmsg(self.serv_sock, len(MSG),
3228 3229 socket.CMSG_SPACE(SIZEOF_INT) +
3229 -socket.CMSG_LEN(SIZEOF_INT)),
3230 +socket.CMSG_LEN(SIZEOF_INT * num_fds)),
3230 3231 maxcmsgs=2, ignoreflags=socket.MSG_CTRUNC)
3231 3232
3232 3233 @testFDPassSeparateMinSpace.client_skip