From 8d9e50989b6b647ce1b32db28a2ed6cbe72f66c7 Mon Sep 17 00:00:00 2001 From: "Dmitry D. Chernov" Date: Mon, 19 Jun 2017 07:34:23 +1000 Subject: [PATCH] Fix temporary Session fields not being defined --- telethon/tl/session.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/telethon/tl/session.py b/telethon/tl/session.py index dc1b13ed..ee5f1091 100644 --- a/telethon/tl/session.py +++ b/telethon/tl/session.py @@ -104,24 +104,24 @@ class JsonSession: those required to init a connection will be copied. """ # These values will NOT be saved - if isinstance(session_user_id, str): - self.session_user_id = session_user_id - - # For connection purposes - self.device_model = platform.node() - self.system_version = platform.system() - self.app_version = '1.0' # note: '0' will provoke error - self.lang_code = 'en' - - elif isinstance(session_user_id, JsonSession): + if isinstance(session_user_id, JsonSession): self.session_user_id = None + # For connection purposes session = session_user_id self.device_model = session.device_model self.system_version = session.system_version self.app_version = session.app_version self.lang_code = session.lang_code + else: # str / None + self.session_user_id = session_user_id + + self.device_model = platform.node() + self.system_version = platform.system() + self.app_version = '1.0' # note: '0' will provoke error + self.lang_code = 'en' + # Cross-thread safety self._lock = Lock()