diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-03-18 22:34:15 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-03-18 22:34:15 +0000 |
commit | 1613ed810801df8327ae6f55b7785fec3a9dc6bb (patch) | |
tree | fc8d5e03ce0e72cbe02874d68d79c1a60b1c2dbb /Lib/tokenize.py | |
parent | 689a55809818a846d2733241642572840d20570b (diff) | |
download | cpython-git-1613ed810801df8327ae6f55b7785fec3a9dc6bb.tar.gz |
fix for files with coding cookies and BOMs
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r-- | Lib/tokenize.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py index 89721371b9..519dfa5784 100644 --- a/Lib/tokenize.py +++ b/Lib/tokenize.py @@ -333,9 +333,11 @@ def detect_encoding(readline): # This behaviour mimics the Python interpreter raise SyntaxError("unknown encoding: " + encoding) - if bom_found and codec.name != 'utf-8': - # This behaviour mimics the Python interpreter - raise SyntaxError('encoding problem: utf-8') + if bom_found: + if codec.name != 'utf-8': + # This behaviour mimics the Python interpreter + raise SyntaxError('encoding problem: utf-8') + encoding += '-sig' return encoding first = read_or_stop() |