| 5198 | # Local imports in this class make for easy security fix backporting. |
| 5199 | |
| 5200 | def setUp(self): |
| 5201 | if hasattr(_socket, "socketpair"): |
| 5202 | self._orig_sp = socket.socketpair |
| 5203 | # This forces the version using the non-OS provided socketpair |
| 5204 | # emulation via an AF_INET socket in Lib/socket.py. |
| 5205 | socket.socketpair = socket._fallback_socketpair |
| 5206 | else: |
| 5207 | # This platform already uses the non-OS provided version. |
| 5208 | self._orig_sp = None |
| 5209 | super().setUp() |
| 5210 | |
| 5211 | def tearDown(self): |
| 5212 | super().tearDown() |