From efb089e1576eaa9326cce08978f81c25169850f2 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 30 Sep 2009 08:30:54 -0400 Subject: Make egg source reading work on py2k and py3k, though i don't like it much... --- coverage/files.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'coverage/files.py') diff --git a/coverage/files.py b/coverage/files.py index cce33c9..9bc8ac5 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -49,9 +49,9 @@ class FileLocator: def get_zip_data(self, filename): """Get data from `filename` if it is a zip file path. - Returns the data read from the zip file, or None if no zip file could - be found or `filename` isn't in it. The data returned might be "" if - the file is empty. + Returns the string data read from the zip file, or None if no zip file + could be found or `filename` isn't in it. The data returned will be + an empty string if the file is empty. """ import zipimport @@ -67,5 +67,7 @@ class FileLocator: data = zi.get_data(parts[1]) except IOError: continue + if sys.hexversion > 0x03000000: + data = data.decode('utf8') # TODO: How to do this properly? return data return None -- cgit v1.2.1