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)