| 5301 | # Local imports in this class make for easy security fix backporting. |
| 5302 | |
| 5303 | def setUp(self): |
| 5304 | if hasattr(_socket, "socketpair"): |
| 5305 | self._orig_sp = socket.socketpair |
| 5306 | # This forces the version using the non-OS provided socketpair |
| 5307 | # emulation via an AF_INET socket in Lib/socket.py. |
| 5308 | socket.socketpair = socket._fallback_socketpair |
| 5309 | else: |
| 5310 | # This platform already uses the non-OS provided version. |
| 5311 | self._orig_sp = None |
| 5312 | super().setUp() |
| 5313 | |
| 5314 | def tearDown(self): |
| 5315 | super().tearDown() |