From 76e5206acc04e835e13746865fe687afe0a87a2d Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 30 Sep 2017 18:45:56 +0200 Subject: [PATCH] Raise ValueError if an unknown **kwarg is given --- telethon/telegram_bare_client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index 75928b69..bec5d8ee 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -118,8 +118,9 @@ class TelegramBareClient: # Used on connection - the user may modify these and reconnect kwargs['app_version'] = kwargs.get('app_version', self.__version__) for name, value in kwargs.items(): - if hasattr(self.session, name): - setattr(self.session, name, value) + if not hasattr(self.session, name): + raise ValueError('Unknown named parameter', name) + setattr(self.session, name, value) # Despite the state of the real connection, keep track of whether # the user has explicitly called .connect() or .disconnect() here.