mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-21 17:06:36 +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()
|
self._log = _Loggers()
|
||||||
|
|
||||||
# Determine what session object we have
|
# Determine what session object we have
|
||||||
if isinstance(session, (str, pathlib.Path)) or session is None:
|
if isinstance(session, (str, pathlib.Path)):
|
||||||
try:
|
try:
|
||||||
session = SQLiteSession(str(session))
|
session = SQLiteSession(str(session))
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -298,6 +298,8 @@ class TelegramBaseClient(abc.ABC):
|
||||||
'you use another session storage'
|
'you use another session storage'
|
||||||
)
|
)
|
||||||
session = MemorySession()
|
session = MemorySession()
|
||||||
|
elif session is None:
|
||||||
|
session = MemorySession()
|
||||||
elif not isinstance(session, Session):
|
elif not isinstance(session, Session):
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
'The given session must be a str or a Session instance.'
|
'The given session must be a str or a Session instance.'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user