Commit d0e2705f authored by Jeremy Hylton's avatar Jeremy Hylton

Open results files, which contain binary pickles, in binary mode.

Remove fallback code that tries to read marshal data from a results
file, since this module never writes marshal data.
parent c2a2832b
...@@ -204,13 +204,11 @@ class CoverageResults: ...@@ -204,13 +204,11 @@ class CoverageResults:
if self.infile: if self.infile:
# Try to merge existing counts file. # Try to merge existing counts file.
try: try:
counts, calledfuncs = pickle.load(open(self.infile, 'r')) counts, calledfuncs = pickle.load(open(self.infile, 'rb'))
self.update(self.__class__(counts, calledfuncs)) self.update(self.__class__(counts, calledfuncs))
except (IOError, EOFError, ValueError), err: except (IOError, EOFError, ValueError), err:
print >> sys.stderr, ("Skipping counts file %r: %s" print >> sys.stderr, ("Skipping counts file %r: %s"
% (self.infile, err)) % (self.infile, err))
except pickle.UnpicklingError:
self.update(self.__class__(marshal.load(open(self.infile))))
def update(self, other): def update(self, other):
"""Merge in the data from another CoverageResults""" """Merge in the data from another CoverageResults"""
...@@ -288,7 +286,7 @@ class CoverageResults: ...@@ -288,7 +286,7 @@ class CoverageResults:
# try and store counts and module info into self.outfile # try and store counts and module info into self.outfile
try: try:
pickle.dump((self.counts, self.calledfuncs), pickle.dump((self.counts, self.calledfuncs),
open(self.outfile, 'w'), 1) open(self.outfile, 'wb'), 1)
except IOError, err: except IOError, err:
print >> sys.stderr, "Can't save counts files because %s" % err print >> sys.stderr, "Can't save counts files because %s" % err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment