Skip to content

Commit bf3f369

Browse files
committed
Fix api_generator.parser._gen_pairs to work in Python 3.7 (PEP 479)
In Python 3.7 recommendation from PEP 479 was enabled. In the new behavior StopIteration exceptions raised directly or indirectly in coroutines and generators are transformed into RuntimeError exceptions.
1 parent 77b55f9 commit bf3f369

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/tensorflow_docs/api_generator/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ def _gen_pairs(items):
386386
The original items, in pairs
387387
"""
388388
assert len(items) % 2 == 0
389+
if not items:
390+
return
389391
items = iter(items)
390392
while True:
391393
yield next(items), next(items)

0 commit comments

Comments
 (0)