--- a/RefactoringRope/JsonClient.py Sat Mar 27 09:48:05 2021 +0100 +++ b/RefactoringRope/JsonClient.py Sat Apr 24 11:19:08 2021 +0200 @@ -13,9 +13,10 @@ import select import traceback import json +import contextlib -class JsonClient(object): +class JsonClient: """ Class implementing the JSON based client base class. """ @@ -151,12 +152,9 @@ }) # Give time to process latest response on server side - try: + with contextlib.suppress(socket.error, OSError): self.__connection.shutdown(socket.SHUT_RDWR) self.__connection.close() - except (socket.error, OSError): - # ignore these; socket might be closed already - pass def poll(self, waitMethod=""): """