summaryrefslogtreecommitdiff
path: root/coverage/phystokens.py
diff options
context:
space:
mode:
authorRoger Hu <roger.hu@gmail.com>2013-05-25 01:31:27 +0000
committerRoger Hu <roger.hu@gmail.com>2013-05-25 01:31:27 +0000
commitdfe83e5fcdb5cc48880fda91d3d78353cb6ce4f7 (patch)
treea735e19c0d9090daaf169a02104402870005e21f /coverage/phystokens.py
parentf10c94d8509aa7cc178a72def0907e97f60903c8 (diff)
downloadpython-coveragepy-dfe83e5fcdb5cc48880fda91d3d78353cb6ce4f7.tar.gz
Make UTF-8 detection more robust.
If the 1st line of the Python is blank/empty, the function assumes that the encoding is 'ascii' and doesn't try for the 2nd line.
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 166020e..df569fc 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -188,7 +188,7 @@ def source_encoding(source):
bom_found = True
first = first[3:]
default = 'utf-8-sig'
- if not first:
+ if first is None:
return default
encoding = find_cookie(first)