commit | 11f0b41e9de3805441ddd4142df9f6b7f4432ca7 | [log] [tgz] |
---|---|---|
author | Florent Xicluna <florent.xicluna@gmail.com> | Sat Jul 07 12:13:35 2012 +0200 |
committer | Florent Xicluna <florent.xicluna@gmail.com> | Sat Jul 07 12:13:35 2012 +0200 |
tree | d32d9eadffd3f5a787bafad084d7bd639ec0eff3 | |
parent | 9235b254dcad979abe36be1024f8e89b04c764be [diff] [blame] |
Issue #14990: tokenize: correctly fail with SyntaxError on invalid encoding declaration.
diff --git a/Lib/tokenize.py b/Lib/tokenize.py index f283c6d..59081d3 100644 --- a/Lib/tokenize.py +++ b/Lib/tokenize.py
@@ -310,7 +310,7 @@ raise SyntaxError("unknown encoding: " + encoding) if bom_found: - if codec.name != 'utf-8': + if encoding != 'utf-8': # This behaviour mimics the Python interpreter raise SyntaxError('encoding problem: utf-8') encoding += '-sig'