[Python-checkins] python/dist/src/Lib trace.py,1.12,1.12.6.1

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Thu Dec 18 04:43:35 EST 2003


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

Modified Files:
      Tag: release23-maint
	trace.py 
Log Message:
Backport 1.13 through 1.15, after getting a begging letter from a certain
BDFL <wink>

  The fullmodname() function chopped off the first character if the
  module existed in the current directory.

  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.12
retrieving revision 1.12.6.1
diff -C2 -d -r1.12 -r1.12.6.1
*** trace.py	15 Jul 2003 10:34:02 -0000	1.12
--- trace.py	18 Dec 2003 09:43:33 -0000	1.12.6.1
***************
*** 181,185 ****
                  longest = dir
  
!     base = path[len(longest) + 1:].replace("/", ".")
      filename, ext = os.path.splitext(base)
      return filename
--- 181,189 ----
                  longest = dir
  
!     if longest:
!         base = path[len(longest) + 1:]
!     else:
!         base = path
!     base = base.replace("/", ".")
      filename, ext = os.path.splitext(base)
      return filename
***************
*** 201,211 ****
              # 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):
***************
*** 285,289 ****
              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