diff options
author | Georg Brandl <georg@python.org> | 2011-05-13 04:54:23 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-05-13 04:54:23 (GMT) |
commit | 325477e20eb6c2b813d06312d9b270706e186ec9 (patch) | |
tree | c74ef0fb8fd32d6e7307128d555f6aa253e13803 /Doc/library | |
parent | cc5ea6860f059049e5c7825d9c3c47600a5d9a42 (diff) | |
download | cpython-325477e20eb6c2b813d06312d9b270706e186ec9.zip cpython-325477e20eb6c2b813d06312d9b270706e186ec9.tar.gz cpython-325477e20eb6c2b813d06312d9b270706e186ec9.tar.bz2 |
Fix unbound local error in RE tokenizer example. Thanks to Herman L. Jackson.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/re.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 3e9cf02..cd3fbb6 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -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): |