summaryrefslogtreecommitdiff
path: root/dev-python/pygments/files/pygments-2.2.0-pep479.patch
blob: 28d40e9566a250513b91eb391f5c2a38e9947e14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# HG changeset patch
# User Miro Hrončok <miro@hroncok.cz>
# Date 1530720528 -7200
# Branch py37
# Node ID 933b5f6afe35e6d554f46085a4e62dc5bf413c87
# Parent  7941677dc77d4f2bf0bbd6140ade85a9454b8b80
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

diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py
--- a/pygments/lexers/lisp.py
+++ b/pygments/lexers/lisp.py
@@ -2327,13 +2327,13 @@
             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
--- a/pygments/lexers/sql.py
+++ b/pygments/lexers/sql.py
@@ -347,7 +347,10 @@
             # 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