summaryrefslogtreecommitdiff
path: root/coverage/phystokens.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-10-05 13:21:16 -0400
committerNed Batchelder <ned@nedbatchelder.com>2013-10-05 13:21:16 -0400
commit554ae8ae796348fb1a3e439967f0ef740b46772e (patch)
tree69472d886e8a61c9c9500ade39bf1712e7ddd5b4 /coverage/phystokens.py
parentb9b08877c2c1c99b181a3e23a2e35e4ea0ff320c (diff)
downloadpython-coveragepy-554ae8ae796348fb1a3e439967f0ef740b46772e.tar.gz
Make everything work on py2.3 again (for the last time).
Diffstat (limited to 'coverage/phystokens.py')
-rw-r--r--coverage/phystokens.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/coverage/phystokens.py b/coverage/phystokens.py
index 9281a44..2a91882 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -177,7 +177,9 @@ def source_encoding(source):
raise SyntaxError("unknown encoding: " + encoding)
if bom_found:
- if codec.name != 'utf-8':
+ # codecs in 2.3 were raw tuples of functions, assume the best.
+ codec_name = getattr(codec, 'name', encoding)
+ if codec_name != 'utf-8':
# This behaviour mimics the Python interpreter
raise SyntaxError('encoding problem: utf-8')
encoding += '-sig'