aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2022-03-15 15:59:02 +0100
committerGitHub <noreply@github.com>2022-03-15 16:59:02 +0200
commit70155412f1543f100d4aa309b8691cbcabd3e0e1 (patch)
tree3e5e79fbcd0032c80a16cff13710d29ea5aafc81 /Lib/asyncio/proactor_events.py
parent6dfe09fc5fd5a3ddc6009d5656e635eae30c5240 (diff)
downloadcpython-70155412f1543f100d4aa309b8691cbcabd3e0e1.tar.gz
cpython-70155412f1543f100d4aa309b8691cbcabd3e0e1.zip
bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892)
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 087f0950d11..ff6d08f78ee 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -158,7 +158,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
# end then it may fail with ERROR_NETNAME_DELETED if we
# just close our end. First calling shutdown() seems to
# cure it, but maybe using DisconnectEx() would be better.
- if hasattr(self._sock, 'shutdown'):
+ if hasattr(self._sock, 'shutdown') and self._sock.fileno() != -1:
self._sock.shutdown(socket.SHUT_RDWR)
self._sock.close()
self._sock = None