Skip to content
Open
4 changes: 3 additions & 1 deletion adlfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ def __init__(

self.do_connect()
weakref.finalize(self, sync, self.loop, close_service_client, self)
weakref.finalize(self, sync, self.loop, close_credential, self)

if self.credential is not None:
weakref.finalize(self, sync, self.loop, close_credential, self)

@classmethod
def _strip_protocol(cls, path: str):
Expand Down