From 5927c118d3556f19199fe502c0ffcc8584652518 Mon Sep 17 00:00:00 2001 From: Miro Hron?ok Date: Wed, 4 Jul 2018 18:08:48 +0200 Subject: 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 --- pygments/lexers/lisp.py | 4 ++-- pygments/lexers/sql.py | 5 ++++- 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 -- cgit v1.2.1