diff options
author | Barry Warsaw <barry@python.org> | 2011-10-07 18:44:49 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2011-10-07 18:44:49 (GMT) |
commit | 78f89d8c38e2c71c5e6a89a32022626a1d8d8922 (patch) | |
tree | 3e7f22261a5bd71fd56a2774c25ecf7c9651055d /Lib/lib2to3/patcomp.py | |
parent | 7b847a46bca22797fcb3149d5e52627fc439ba18 (diff) | |
download | cpython-78f89d8c38e2c71c5e6a89a32022626a1d8d8922.zip cpython-78f89d8c38e2c71c5e6a89a32022626a1d8d8922.tar.gz cpython-78f89d8c38e2c71c5e6a89a32022626a1d8d8922.tar.bz2 |
- Issue #11250: Back port fix from 3.3 branch, so that 2to3 can handle files
with line feeds. This was ported from the sandbox to the 3.3 branch, but
didn't make it into 3.2.
- Re-enable lib2to3's test_parser.py tests, though with an expected failure
(see issue 13125).
Diffstat (limited to 'Lib/lib2to3/patcomp.py')
-rw-r--r-- | Lib/lib2to3/patcomp.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/lib2to3/patcomp.py b/Lib/lib2to3/patcomp.py index bb538d5..0a259e9 100644 --- a/Lib/lib2to3/patcomp.py +++ b/Lib/lib2to3/patcomp.py @@ -11,6 +11,7 @@ The compiler compiles a pattern to a pytree.*Pattern instance. __author__ = "Guido van Rossum <guido@python.org>" # Python imports +import io import os # Fairly local imports @@ -32,7 +33,7 @@ class PatternSyntaxError(Exception): def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = set((token.NEWLINE, token.INDENT, token.DEDENT)) - tokens = tokenize.generate_tokens(driver.generate_lines(input).__next__) + tokens = tokenize.generate_tokens(io.StringIO(input).readline) for quintuple in tokens: type, value, start, end, line_text = quintuple if type not in skip: |