Skip to content

Commit 4f8d1ca

Browse files
committed
make sockets live only as little as possible
1 parent 7368656 commit 4f8d1ca

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/test/test_socket.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7373,13 +7373,13 @@ def testSendAndRecvFds(self):
73737373
self._test_pipe(rfd, wfd, str(index).encode())
73747374

73757375
def test_send_recv_fds_with_addrs(self):
7376-
sock1 = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
7377-
sock2 = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
73787376
rfd, wfd = os.pipe()
73797377
self.addCleanup(os.close, rfd)
73807378
self.addCleanup(os.close, wfd)
73817379

7382-
with tempfile.TemporaryDirectory() as tmpdir, sock1, sock2:
7380+
with tempfile.TemporaryDirectory() as tmpdir, \
7381+
socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) as sock1, \
7382+
socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) as sock2:
73837383
sock1_addr = os.path.join(tmpdir, "sock1")
73847384
sock2_addr = os.path.join(tmpdir, "sock2")
73857385
sock1.bind(sock1_addr)

0 commit comments

Comments
 (0)