diff --git a/Lib/trace.py b/Lib/trace.py index ade55bd5519..7f412633cf8 100644 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -204,13 +204,11 @@ def __init__(self, counts=None, calledfuncs=None, infile=None, if self.infile: # Try to merge existing counts file. try: - counts, calledfuncs = pickle.load(open(self.infile, 'r')) + counts, calledfuncs = pickle.load(open(self.infile, 'rb')) self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError, ValueError), err: print >> sys.stderr, ("Skipping counts file %r: %s" % (self.infile, err)) - except pickle.UnpicklingError: - self.update(self.__class__(marshal.load(open(self.infile)))) def update(self, other): """Merge in the data from another CoverageResults""" @@ -288,7 +286,7 @@ def write_results(self, show_missing=True, summary=False, coverdir=None): # try and store counts and module info into self.outfile try: pickle.dump((self.counts, self.calledfuncs), - open(self.outfile, 'w'), 1) + open(self.outfile, 'wb'), 1) except IOError, err: print >> sys.stderr, "Can't save counts files because %s" % err