diff options
| author | Miro Hron?ok <miro@hroncok.cz> | 2018-07-04 18:08:48 +0200 |
|---|---|---|
| committer | Miro Hron?ok <miro@hroncok.cz> | 2018-07-04 18:08:48 +0200 |
| commit | 1d494b833009cccce7eabe0635786e688d79c93f (patch) | |
| tree | 3fa5aac9afbdb1ffae60f126b5c065199f83b877 | |
| parent | 1b966038502c0b386a6645d4b5125f623d0947bb (diff) | |
| download | pygments-git-1d494b833009cccce7eabe0635786e688d79c93f.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.py | 4 | ||||
| -rw-r--r-- | 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 |
