1
0
Fork 0
mirror of https://github.com/veekun/pokedex.git synced 2024-08-20 18:16:34 +00:00

Fix StopIteration causing program termination

This commit is contained in:
Kip Yin 2019-02-04 15:47:52 +08:00 committed by GitHub
parent 18925edcd3
commit 43da1dab3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -377,7 +377,10 @@ def group_by_object(stream):
Yields ((class name, object ID), (list of messages)) pairs.
"""
stream = iter(stream)
current = next(stream)
try:
current = next(stream)
except StopIteration:
yield StopIteration
current_key = current.cls, current.id
group = [current]
for message in stream: