074c446797
* python-genshi-py3-escape-sequence-doctest.patch * python-genshi-py37-stopiteration.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Genshi?expand=0&rev=13
48 lines
1.5 KiB
Diff
48 lines
1.5 KiB
Diff
From 6fed7cdbf1b9f35fa085e22fc0d87d0614625313 Mon Sep 17 00:00:00 2001
|
|
From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
|
|
Date: Fri, 29 Jun 2018 08:58:18 +0200
|
|
Subject: [PATCH 1/2] catch StopIteration and use plain "return" (Python 3.7
|
|
compatibility)
|
|
|
|
In Python 3.7 StopIteration exceptions are transformed to RuntimeErrors (PEP 479).
|
|
|
|
Probably we need to do this in more places but this gets the test suite passing
|
|
at least.
|
|
---
|
|
genshi/core.py | 5 ++++-
|
|
genshi/filters/transform.py | 2 +-
|
|
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/genshi/core.py b/genshi/core.py
|
|
index 8c4c93d..d0e8ff6 100644
|
|
--- a/genshi/core.py
|
|
+++ b/genshi/core.py
|
|
@@ -270,7 +270,10 @@ COMMENT = Stream.COMMENT
|
|
def _ensure(stream):
|
|
"""Ensure that every item on the stream is actually a markup event."""
|
|
stream = iter(stream)
|
|
- event = stream.next()
|
|
+ try:
|
|
+ event = stream.next()
|
|
+ except StopIteration:
|
|
+ return
|
|
|
|
# Check whether the iterable is a real markup event stream by examining the
|
|
# first item it yields; if it's not we'll need to do some conversion
|
|
diff --git a/genshi/filters/transform.py b/genshi/filters/transform.py
|
|
index 569fc05..d7475db 100644
|
|
--- a/genshi/filters/transform.py
|
|
+++ b/genshi/filters/transform.py
|
|
@@ -119,7 +119,7 @@ class PushBackStream(object):
|
|
yield event
|
|
except StopIteration:
|
|
if self.peek is None:
|
|
- raise
|
|
+ return
|
|
|
|
|
|
class Transformer(object):
|
|
--
|
|
2.17.1
|
|
|