Avoid relying on .__iter__ to tell iterators apart

.send_file() would fail with stream objects (those from open())
since they are iterable, and asserting that they weren't bytes
or str was not enough.
This commit is contained in:
Lonami Exo
2018-02-26 14:12:21 +01:00
parent 6f16aeb553
commit 5a54e2279f
4 changed files with 19 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ def _into_id_set(client, chats):
if chats is None:
return None
if not hasattr(chats, '__iter__') or isinstance(chats, str):
if not utils.is_list_like(chats):
chats = (chats,)
result = set()