From 3618b9567ad06989b52f415d9a9af001ad2acb5d Mon Sep 17 00:00:00 2001 From: AZero13 Date: Mon, 8 Dec 2025 00:50:31 -0500 Subject: [PATCH] gh-142403: Avoid leaking file descriptor in socket.py --- Lib/socket.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/socket.py b/Lib/socket.py index 3073c012b19..6eb24acdb5c 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -416,6 +416,7 @@ def _sendfile_zerocopy(self, zerocopy_func, giveup_exc_type, file, total_sent += sent return total_sent finally: + selector.close() if total_sent > 0 and hasattr(file, 'seek'): file.seek(offset)