summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiro Hron?ok <miro@hroncok.cz>2018-07-04 18:08:48 +0200
committerMiro Hron?ok <miro@hroncok.cz>2018-07-04 18:08:48 +0200
commit5927c118d3556f19199fe502c0ffcc8584652518 (patch)
tree6385e3b366525cee3d47cb75dd8b0575137b46c8
parent0db8e281af377923115b894703b2b8beb8f1e9d5 (diff)
downloadpygments-5927c118d3556f19199fe502c0ffcc8584652518.tar.gz
PEP 479: Raising StopIteration from a generator is now an error
So we return instead. Fix needed for Python 3.7. Fixes https://bitbucket.org/birkenfeld/pygments-main/issues/1457
-rw-r--r--pygments/lexers/lisp.py4
-rw-r--r--pygments/lexers/sql.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py
index e258c347..258916df 100644
--- a/pygments/lexers/lisp.py
+++ b/pygments/lexers/lisp.py
@@ -2327,13 +2327,13 @@ class ShenLexer(RegexLexer):
token = Name.Function if token == Literal else token
yield index, token, value
- raise StopIteration
+ return
def _process_signature(self, tokens):
for index, token, value in tokens:
if token == Literal and value == '}':
yield index, Punctuation, value
- raise StopIteration
+ return
elif token in (Literal, Name.Function):
token = Name.Variable if value.istitle() else Keyword.Type
yield index, token, value
diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py
index 7507c0fc..05af51ba 100644
--- a/pygments/lexers/sql.py
+++ b/pygments/lexers/sql.py
@@ -347,7 +347,10 @@ class PostgresConsoleLexer(Lexer):
# Emit the output lines
out_token = Generic.Output
while 1:
- line = next(lines)
+ try:
+ line = next(lines)
+ except StopIteration:
+ return
mprompt = re_prompt.match(line)
if mprompt is not None:
# push the line back to have it processed by the prompt