From 0a8a32daba21401ccb9101eb59b2b9de3e22df25 Mon Sep 17 00:00:00 2001 From: tomasz t Date: Sat, 17 Feb 2024 15:18:24 +0100 Subject: [PATCH] make sure kwargs that are passed to sftp_client_kwargs are acceptable --- sshfs/pools/base.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sshfs/pools/base.py b/sshfs/pools/base.py index 478d2a1..a36fd08 100644 --- a/sshfs/pools/base.py +++ b/sshfs/pools/base.py @@ -38,7 +38,18 @@ def __init__( self.unsafe_terminate = unsafe_terminate self._stack = AsyncExitStack() - self.other_init_params = kwargs or {} + self.sftp_client_kwargs = { + k: v + for k, v in kwargs.items() + if k + in { + "env", + "send_env", + "path_encoding", + "path_errors", + "sftp_version", + } + } async def _maybe_new_channel(self): # If there is no hard limit or the limit is not hit yet @@ -49,7 +60,7 @@ async def _maybe_new_channel(self): ): try: return await self._stack.enter_async_context( - self.client.start_sftp_client(**self.other_init_params) + self.client.start_sftp_client(**self.sftp_client_kwargs) ) except ChannelOpenError: # If we can't create any more channels, then change