mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-24 10:23:44 +03:00
Fix TelegramClient init with None session (#4339)
This commit is contained in:
parent
75d609ab2a
commit
9f3e7e4aa8
|
@ -285,7 +285,7 @@ class TelegramBaseClient(abc.ABC):
|
|||
self._log = _Loggers()
|
||||
|
||||
# Determine what session object we have
|
||||
if isinstance(session, (str, pathlib.Path)) or session is None:
|
||||
if isinstance(session, (str, pathlib.Path)):
|
||||
try:
|
||||
session = SQLiteSession(str(session))
|
||||
except ImportError:
|
||||
|
@ -298,6 +298,8 @@ class TelegramBaseClient(abc.ABC):
|
|||
'you use another session storage'
|
||||
)
|
||||
session = MemorySession()
|
||||
elif session is None:
|
||||
session = MemorySession()
|
||||
elif not isinstance(session, Session):
|
||||
raise TypeError(
|
||||
'The given session must be a str or a Session instance.'
|
||||
|
|
Loading…
Reference in New Issue
Block a user