From fa789e975b08ba1a40fc7163fc72a0b26a353ad3 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 15 Dec 2023 11:07:56 +0000 Subject: [PATCH] fix a KeyError --- vcr/patch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcr/patch.py b/vcr/patch.py index d1527a5..d6dd9b7 100644 --- a/vcr/patch.py +++ b/vcr/patch.py @@ -386,7 +386,10 @@ class ConnectionRemover: while pool.pool and not pool.pool.empty() and connections: connection = pool.pool.get() if isinstance(connection, self._connection_class): - connections.remove(connection) + try: + connections.remove(connection) + except KeyError: + pass connection.close() else: readd_connections.append(connection)