aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_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/test/test_asyncio/test_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/test/test_asyncio/test_proactor_events.py')
-rw-r--r--Lib/test/test_asyncio/test_proactor_events.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_proactor_events.py b/Lib/test/test_asyncio/test_proactor_events.py
index 67573823ecb..7fca0541ee7 100644
--- a/Lib/test/test_asyncio/test_proactor_events.py
+++ b/Lib/test/test_asyncio/test_proactor_events.py
@@ -242,6 +242,14 @@ class ProactorSocketTransportTests(test_utils.TestCase):
test_utils.run_briefly(self.loop)
self.assertFalse(self.protocol.connection_lost.called)
+ def test_close_invalid_sockobj(self):
+ tr = self.socket_transport()
+ self.sock.fileno.return_value = -1
+ tr.close()
+ test_utils.run_briefly(self.loop)
+ self.protocol.connection_lost.assert_called_with(None)
+ self.assertFalse(self.sock.shutdown.called)
+
@mock.patch('asyncio.base_events.logger')
def test_fatal_error(self, m_logging):
tr = self.socket_transport()