From 11f0b41e9de3805441ddd4142df9f6b7f4432ca7 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Sat, 7 Jul 2012 12:13:35 +0200 Subject: Issue #14990: tokenize: correctly fail with SyntaxError on invalid encoding declaration. --- Lib/tokenize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/tokenize.py') diff --git a/Lib/tokenize.py b/Lib/tokenize.py index f283c6dd7f..59081d3579 100644 --- a/Lib/tokenize.py +++ b/Lib/tokenize.py @@ -310,7 +310,7 @@ def detect_encoding(readline): 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' -- cgit v1.2.1