[Python-checkins] python/dist/src/Lib trace.py,1.14,1.15

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Tue Oct 14 16:12:08 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv18103

Modified Files:
	trace.py 
Log Message:
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.


Index: trace.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** trace.py	10 Oct 2003 23:05:41 -0000	1.14
--- trace.py	14 Oct 2003 20:12:06 -0000	1.15
***************
*** 205,215 ****
              # Try to merge existing counts file.
              try:
!                 counts, calledfuncs = pickle.load(open(self.infile, 'r'))
                  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):
--- 205,213 ----
              # Try to merge existing counts file.
              try:
!                 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))
  
      def update(self, other):
***************
*** 289,293 ****
              try:
                  pickle.dump((self.counts, self.calledfuncs),
!                             open(self.outfile, 'w'), 1)
              except IOError, err:
                  print >> sys.stderr, "Can't save counts files because %s" % err
--- 287,291 ----
              try:
                  pickle.dump((self.counts, self.calledfuncs),
!                             open(self.outfile, 'wb'), 1)
              except IOError, err:
                  print >> sys.stderr, "Can't save counts files because %s" % err





More information about the Python-checkins mailing list