summaryrefslogtreecommitdiff
path: root/coverage/phystokens.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2014-06-29 14:35:02 -0700
committerAnthony Sottile <asottile@umich.edu>2014-06-29 14:35:02 -0700
commit460d303ed2361abe554da075c184a370d7d54701 (patch)
treef01bcc1a39146c32f9ce442b442d18b21cc66d94 /coverage/phystokens.py
parentbe5178fda38750c0aae78061bf1b1bf3397a467d (diff)
downloadpython-coveragepy-git-460d303ed2361abe554da075c184a370d7d54701.tar.gz
Fix non-comment encoding detection.
--HG-- branch : fix_source_encoding
Diffstat (limited to 'coverage/phystokens.py')
-rw-r--r--coverage/phystokens.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/coverage/phystokens.py b/coverage/phystokens.py
index e79ce01f..867388f7 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -120,7 +120,7 @@ def source_encoding(source):
# This is mostly code adapted from Py3.2's tokenize module.
- cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)")
+ cookie_re = re.compile(r"^\s*#.*coding[:=]\s*([-\w.]+)")
# Do this so the detect_encode code we copied will work.
readline = iter(source.splitlines(True)).next