the encoding directive must be a comment

This commit is contained in:
Buck Golemon 2012-04-24 15:45:35 -07:00
parent 8c6fe8681b
commit bd8c52d8d2
2 changed files with 6 additions and 1 deletions

View File

@ -78,7 +78,7 @@ def lookup_module(filename):
# stolen from Python 3.1's tokenize.py, by Ka-Ping Yee
import re
cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
cookie_re = re.compile("^\s*#.*coding[:=]\s*([-\w.]+)")
from codecs import lookup, BOM_UTF8
def detect_encoding(readline):

5
test/test-encoding.py Normal file
View File

@ -0,0 +1,5 @@
def f(encoding=None):
print 'ENCODING:', encoding
from pudb import runcall
runcall(f)