Always run SyncWrapper.close on __exit__

This commit is contained in:
Daniel A. Wozniak 2023-07-15 14:44:25 -07:00 committed by Gareth J. Greenaway
parent e79e3899e4
commit c1cc4e23af

View file

@ -168,6 +168,5 @@ class SyncWrapper:
def __exit__(self, exc_type, exc_val, tb):
if hasattr(self.obj, "__aexit__"):
return self._wrap("__aexit__")(exc_type, exc_val, tb)
else:
self.close()
self._wrap("__aexit__")(exc_type, exc_val, tb)
self.close()