[Python-checkins] cpython (3.2): Fix unbound local error in RE tokenizer example. Thanks to Herman L. Jackson.

georg.brandl python-checkins at python.org
Fri May 13 07:01:57 CEST 2011


http://hg.python.org/cpython/rev/538a6b23b18f
changeset:   70066:538a6b23b18f
branch:      3.2
user:        Georg Brandl <georg at python.org>
date:        Fri May 13 06:54:23 2011 +0200
summary:
  Fix unbound local error in RE tokenizer example. Thanks to Herman L. Jackson.

files:
  Doc/library/re.rst |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Doc/library/re.rst b/Doc/library/re.rst
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -1322,9 +1322,10 @@
                 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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list