From 554ae8ae796348fb1a3e439967f0ef740b46772e Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 5 Oct 2013 13:21:16 -0400 Subject: Make everything work on py2.3 again (for the last time). --- coverage/phystokens.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'coverage') 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' -- cgit v1.2.1