gh-142403: Avoid leaking file descriptor in socket.py

This commit is contained in:
AZero13 2025-12-08 00:50:31 -05:00
parent 3db7bf2d18
commit 3618b9567a

View file

@ -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)