]> granicus.if.org Git - python/commitdiff
Fix unbound local error in RE tokenizer example. Thanks to Herman L. Jackson.
authorGeorg Brandl <georg@python.org>
Fri, 13 May 2011 04:54:23 +0000 (06:54 +0200)
committerGeorg Brandl <georg@python.org>
Fri, 13 May 2011 04:54:23 +0000 (06:54 +0200)
Doc/library/re.rst

index 3e9cf026f07df167f3782fab53c9b48803247809..cd3fbb6be0e4ca95af5344ea38406e3b28931255 100644 (file)
@@ -1322,9 +1322,10 @@ successive matches::
                 line_start = pos
                 line += 1
             elif typ != 'SKIP':
+                val = mo.group(typ)
                 if typ == 'ID' and val in keywords:
                     typ = val
-                yield Token(typ, mo.group(typ), line, mo.start()-line_start)
+                yield Token(typ, val, line, mo.start()-line_start)
             pos = mo.end()
             mo = gettok(s, pos)
         if pos != len(s):