|
1 | 1 | import unittest
|
2 |
| -import warnings |
3 | 2 | from test import support
|
4 | 3 | from test.support import (
|
5 |
| - is_apple, os_helper, refleak_helper, socket_helper, threading_helper, |
| 4 | + is_apple, os_helper, refleak_helper, socket_helper, threading_helper |
6 | 5 | )
|
7 | 6 | import _thread as thread
|
8 | 7 | import array
|
@@ -199,24 +198,6 @@ def socket_setdefaulttimeout(timeout):
|
199 | 198 | socket.setdefaulttimeout(old_timeout)
|
200 | 199 |
|
201 | 200 |
|
202 |
| -@contextlib.contextmanager |
203 |
| -def downgrade_malformed_data_warning(): |
204 |
| - # This warning happens on macos and win, but does not always happen on linux. |
205 |
| - if sys.platform not in {"win32", "darwin"}: |
206 |
| - yield |
207 |
| - return |
208 |
| - |
209 |
| - with warnings.catch_warnings(): |
210 |
| - # TODO: gh-110012, we should investigate why this warning is happening |
211 |
| - # and fix it properly. |
212 |
| - warnings.filterwarnings( |
213 |
| - action="always", |
214 |
| - message=r"received malformed or improperly-truncated ancillary data", |
215 |
| - category=RuntimeWarning, |
216 |
| - ) |
217 |
| - yield |
218 |
| - |
219 |
| - |
220 | 201 | HAVE_SOCKET_CAN = _have_socket_can()
|
221 | 202 |
|
222 | 203 | HAVE_SOCKET_CAN_ISOTP = _have_socket_can_isotp()
|
@@ -3965,9 +3946,8 @@ def checkTruncatedArray(self, ancbuf, maxdata, mindata=0):
|
3965 | 3946 | # mindata and maxdata bytes when received with buffer size
|
3966 | 3947 | # ancbuf, and that any complete file descriptor numbers are
|
3967 | 3948 | # valid.
|
3968 |
| - with downgrade_malformed_data_warning(): # TODO: gh-110012 |
3969 |
| - msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock, |
3970 |
| - len(MSG), ancbuf) |
| 3949 | + msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock, |
| 3950 | + len(MSG), ancbuf) |
3971 | 3951 | self.assertEqual(msg, MSG)
|
3972 | 3952 | self.checkRecvmsgAddress(addr, self.cli_addr)
|
3973 | 3953 | self.checkFlags(flags, eor=True, checkset=socket.MSG_CTRUNC)
|
@@ -4318,9 +4298,8 @@ def testSingleCmsgTruncInData(self):
|
4318 | 4298 | self.serv_sock.setsockopt(socket.IPPROTO_IPV6,
|
4319 | 4299 | socket.IPV6_RECVHOPLIMIT, 1)
|
4320 | 4300 | self.misc_event.set()
|
4321 |
| - with downgrade_malformed_data_warning(): # TODO: gh-110012 |
4322 |
| - msg, ancdata, flags, addr = self.doRecvmsg( |
4323 |
| - self.serv_sock, len(MSG), socket.CMSG_LEN(SIZEOF_INT) - 1) |
| 4301 | + msg, ancdata, flags, addr = self.doRecvmsg( |
| 4302 | + self.serv_sock, len(MSG), socket.CMSG_LEN(SIZEOF_INT) - 1) |
4324 | 4303 |
|
4325 | 4304 | self.assertEqual(msg, MSG)
|
4326 | 4305 | self.checkRecvmsgAddress(addr, self.cli_addr)
|
@@ -4423,10 +4402,9 @@ def testSecondCmsgTruncInData(self):
|
4423 | 4402 | self.serv_sock.setsockopt(socket.IPPROTO_IPV6,
|
4424 | 4403 | socket.IPV6_RECVTCLASS, 1)
|
4425 | 4404 | self.misc_event.set()
|
4426 |
| - with downgrade_malformed_data_warning(): # TODO: gh-110012 |
4427 |
| - msg, ancdata, flags, addr = self.doRecvmsg( |
4428 |
| - self.serv_sock, len(MSG), |
4429 |
| - socket.CMSG_SPACE(SIZEOF_INT) + socket.CMSG_LEN(SIZEOF_INT) - 1) |
| 4405 | + msg, ancdata, flags, addr = self.doRecvmsg( |
| 4406 | + self.serv_sock, len(MSG), |
| 4407 | + socket.CMSG_SPACE(SIZEOF_INT) + socket.CMSG_LEN(SIZEOF_INT) - 1) |
4430 | 4408 |
|
4431 | 4409 | self.assertEqual(msg, MSG)
|
4432 | 4410 | self.checkRecvmsgAddress(addr, self.cli_addr)
|
|
0 commit comments