[py3] Handle PEP 479 Py3.8 generator raised StopIteration
@@ -57,8 +57,10 @@ LOG = logging.getLogger(__name__)
def escape_rows(rows, nulls_only=False, encoding=None):
data = []
+ try:
for row in rows:
escaped_row = []
+
for field in row:
if isinstance(field, numbers.Number):
if math.isnan(field) or math.isinf(field):
@@ -73,6 +75,8 @@ def escape_rows(rows, nulls_only=False, encoding=None):
escaped_field = escape(escaped_field).replace(' ', '&nbsp;')
escaped_row.append(escaped_field)
data.append(escaped_row)
+ except RuntimeError:
+ pass # pep-0479: expected Py3.8 generator raised StopIteration
return data
