mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-11-12 20:10:38 +00:00
Handle negative limits gracefully in async generators
We rely on >= 0 for setting the batch size to use (which must be valid), so it makes sense to make negative limits equal 0. This is similar to how asyncio.sleep(negative) sleeps 0 seconds, despite the fact that time.sleep(negative) fails.
This commit is contained in:
@@ -37,7 +37,7 @@ class _ParticipantsIter(RequestIter):
|
||||
functions.channels.GetFullChannelRequest(entity)
|
||||
)).full_chat.participants_count
|
||||
|
||||
if self.limit == 0:
|
||||
if self.limit <= 0:
|
||||
raise StopAsyncIteration
|
||||
|
||||
self.seen = set()
|
||||
|
||||
Reference in New Issue
Block a user