[Python-checkins] CVS: python/dist/src/Lib ConfigParser.py,1.25,1.26 Cookie.py,1.4,1.5 calendar.py,1.19,1.20 cgi.py,1.57,1.58 chunk.py,1.5,1.6 codecs.py,1.14,1.15 commands.py,1.13,1.14 copy.py,1.17,1.18 dis.py,1.27,1.28 dospath.py,1.20,1.21 dumbdbm.py,1.6,1.7 filecmp.py,1.8,1.9 fnmatch.py,1.8,1.9 formatter.py,1.15,1.16 fpformat.py,1.7,1.8 ftplib.py,1.46,1.47

Tim Peters python-dev@python.org
Sun, 14 Jan 2001 15:36:08 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv29400/python/dist/src/lib

Modified Files:
	ConfigParser.py Cookie.py calendar.py cgi.py chunk.py 
	codecs.py commands.py copy.py dis.py dospath.py dumbdbm.py 
	filecmp.py fnmatch.py formatter.py fpformat.py ftplib.py 
Log Message:
Whitespace normalization.


Index: ConfigParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** ConfigParser.py	2000/12/11 18:13:19	1.25
--- ConfigParser.py	2001/01/14 23:36:05	1.26
***************
*** 74,81 ****
  
      remove_section(section)
! 	remove the given file section and all its options
  
      remove_option(section, option)
! 	remove the given option from the given section
  
      set(section, option, value)
--- 74,81 ----
  
      remove_section(section)
!         remove the given file section and all its options
  
      remove_option(section, option)
!         remove the given option from the given section
  
      set(section, option, value)
***************
*** 83,87 ****
  
      write(fp)
! 	write the configuration state in .ini format
  """
  
--- 83,87 ----
  
      write(fp)
!         write the configuration state in .ini format
  """
  
***************
*** 95,99 ****
  
  
! 
  # exception classes
  class Error(Exception):
--- 95,99 ----
  
  
! 
  # exception classes
  class Error(Exception):
***************
*** 166,171 ****
          self.line = line
  
  
- 
  class ConfigParser:
      def __init__(self, defaults=None):
--- 166,171 ----
          self.line = line
  
+ 
  
  class ConfigParser:
      def __init__(self, defaults=None):
***************
*** 218,222 ****
      def read(self, filenames):
          """Read and parse a filename or a list of filenames.
!         
          Files that cannot be opened are silently ignored; this is
          designed so that you can specify a list of potential
--- 218,222 ----
      def read(self, filenames):
          """Read and parse a filename or a list of filenames.
! 
          Files that cannot be opened are silently ignored; this is
          designed so that you can specify a list of potential
***************
*** 286,290 ****
          # do the string interpolation
          value = rawval                  # Make it a pretty variable name
!         depth = 0                       
          while depth < 10:               # Loop through this until it's done
              depth = depth + 1
--- 286,290 ----
          # do the string interpolation
          value = rawval                  # Make it a pretty variable name
!         depth = 0
          while depth < 10:               # Loop through this until it's done
              depth = depth + 1
***************
*** 299,303 ****
              raise InterpolationDepthError(option, section, rawval)
          return value
!     
      def __get(self, section, conv, option):
          return conv(self.get(section, option))
--- 299,303 ----
              raise InterpolationDepthError(option, section, rawval)
          return value
! 
      def __get(self, section, conv, option):
          return conv(self.get(section, option))

Index: Cookie.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/Cookie.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Cookie.py	2000/12/12 23:20:44	1.4
--- Cookie.py	2001/01/14 23:36:05	1.5
***************
*** 4,10 ****
  ####
  # Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>
! # 
  #                All Rights Reserved
! # 
  # Permission to use, copy, modify, and distribute this software
  # and its documentation for any purpose and without fee is hereby
--- 4,10 ----
  ####
  # Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>
! #
  #                All Rights Reserved
! #
  # Permission to use, copy, modify, and distribute this software
  # and its documentation for any purpose and without fee is hereby
***************
*** 14,19 ****
  # Timothy O'Malley  not be used in advertising or publicity
  # pertaining to distribution of the software without specific, written
! # prior permission. 
! # 
  # Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  # SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
--- 14,19 ----
  # Timothy O'Malley  not be used in advertising or publicity
  # pertaining to distribution of the software without specific, written
! # prior permission.
! #
  # Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  # SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
***************
*** 23,31 ****
  # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
! # PERFORMANCE OF THIS SOFTWARE. 
  #
  ####
! # 
! # Id: Cookie.py,v 2.29 2000/08/23 05:28:49 timo Exp 
  #   by Timothy O'Malley <timo@alum.mit.edu>
  #
--- 23,31 ----
  # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
! # PERFORMANCE OF THIS SOFTWARE.
  #
  ####
! #
! # Id: Cookie.py,v 2.29 2000/08/23 05:28:49 timo Exp
  #   by Timothy O'Malley <timo@alum.mit.edu>
  #
***************
*** 117,121 ****
  
  Each dictionary element has a 'value' attribute, which gives you
! back the value associated with the key. 
  
     >>> C = Cookie.SmartCookie()
--- 117,121 ----
  
  Each dictionary element has a 'value' attribute, which gives you
! back the value associated with the key.
  
     >>> C = Cookie.SmartCookie()
***************
*** 149,153 ****
     Set-Cookie: string=seven;
  
!  
  SerialCookie
  
--- 149,153 ----
     Set-Cookie: string=seven;
  
! 
  SerialCookie
  
***************
*** 215,219 ****
  #
  # Import our required modules
! # 
  import string, sys
  from UserDict import UserDict
--- 215,219 ----
  #
  # Import our required modules
! #
  import string, sys
  from UserDict import UserDict
***************
*** 243,247 ****
  # three-digit octal equivalent of the character.  Any '\' or '"' is
  # quoted with a preceeding '\' slash.
! # 
  # These are taken from RFC2068 and RFC2109.
  #       _LegalChars       is the list of chars which don't require "'s
--- 243,247 ----
  # three-digit octal equivalent of the character.  Any '\' or '"' is
  # quoted with a preceeding '\' slash.
! #
  # These are taken from RFC2068 and RFC2109.
  #       _LegalChars       is the list of chars which don't require "'s
***************
*** 320,324 ****
          return str
      else:
!         return '"' + join( map(_Translator.get, str, str), "" ) + '"'    
  # end _quote
  
--- 320,324 ----
          return str
      else:
!         return '"' + join( map(_Translator.get, str, str), "" ) + '"'
  # end _quote
  
***************
*** 371,375 ****
  # The _getdate() routine is used to set the expiration time in
  # the cookie's HTTP header.      By default, _getdate() returns the
! # current time in the appropriate "expires" format for a 
  # Set-Cookie header.     The one optional argument is an offset from
  # now, in seconds.      For example, an offset of -3600 means "one hour ago".
--- 371,375 ----
  # The _getdate() routine is used to set the expiration time in
  # the cookie's HTTP header.      By default, _getdate() returns the
! # current time in the appropriate "expires" format for a
  # Set-Cookie header.     The one optional argument is an offset from
  # now, in seconds.      For example, an offset of -3600 means "one hour ago".
***************
*** 406,410 ****
      #   path       comment         domain
      #   max-age    secure      version
!     # 
      # For historical reasons, these attributes are also reserved:
      #   expires
--- 406,410 ----
      #   path       comment         domain
      #   max-age    secure      version
!     #
      # For historical reasons, these attributes are also reserved:
      #   expires

Index: calendar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** calendar.py	2000/12/12 23:20:44	1.19
--- calendar.py	2001/01/14 23:36:05	1.20
***************
*** 132,136 ****
      w = max(2, w)
      l = max(1, l)
!     s = (_center(month_name[themonth] + ' ' + `theyear`, 
                   7 * (w + 1) - 1).rstrip() +
           '\n' * l + weekheader(w).rstrip() + '\n' * l)
--- 132,136 ----
      w = max(2, w)
      l = max(1, l)
!     s = (_center(month_name[themonth] + ' ' + `theyear`,
                   7 * (w + 1) - 1).rstrip() +
           '\n' * l + weekheader(w).rstrip() + '\n' * l)
***************
*** 168,172 ****
          s = (s + '\n' * l +
               format3cstring(month_name[q], month_name[q+1], month_name[q+2],
!                             colwidth, c).rstrip() + 
               '\n' * l + header + '\n' * l)
          data = []
--- 168,172 ----
          s = (s + '\n' * l +
               format3cstring(month_name[q], month_name[q+1], month_name[q+2],
!                             colwidth, c).rstrip() +
               '\n' * l + header + '\n' * l)
          data = []
***************
*** 184,188 ****
                  else:
                      weeks.append(week(cal[i], w))
!             s = s + format3cstring(weeks[0], weeks[1], weeks[2], 
                                     colwidth, c).rstrip() + '\n' * l
      return s[:-l] + '\n'
--- 184,188 ----
                  else:
                      weeks.append(week(cal[i], w))
!             s = s + format3cstring(weeks[0], weeks[1], weeks[2],
                                     colwidth, c).rstrip() + '\n' * l
      return s[:-l] + '\n'

Index: cgi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** cgi.py	2000/12/27 19:12:40	1.57
--- cgi.py	2001/01/14 23:36:05	1.58
***************
*** 12,16 ****
  # History
  # -------
! # 
  # Michael McLay started this module.  Steve Majewski changed the
  # interface to SvFormContentDict and FormContentDict.  The multipart
--- 12,16 ----
  # History
  # -------
! #
  # Michael McLay started this module.  Steve Majewski changed the
  # interface to SvFormContentDict and FormContentDict.  The multipart
***************
*** 18,22 ****
  # Rossum rewrote, reformatted and documented the module and is currently
  # responsible for its maintenance.
! # 
  
  __version__ = "2.5"
--- 18,22 ----
  # Rossum rewrote, reformatted and documented the module and is currently
  # responsible for its maintenance.
! #
  
  __version__ = "2.5"
***************
*** 105,110 ****
  
          keep_blank_values: flag indicating whether blank values in
!             URL encoded forms should be treated as blank strings.  
!             A true value indicates that blanks should be retained as 
              blank strings.  The default false value indicates that
              blank values are to be ignored and treated as if they were
--- 105,110 ----
  
          keep_blank_values: flag indicating whether blank values in
!             URL encoded forms should be treated as blank strings.
!             A true value indicates that blanks should be retained as
              blank strings.  The default false value indicates that
              blank values are to be ignored and treated as if they were
***************
*** 130,137 ****
          else:
              qs = ''                     # Unknown content-type
!         if environ.has_key('QUERY_STRING'): 
              if qs: qs = qs + '&'
              qs = qs + environ['QUERY_STRING']
!         elif sys.argv[1:]: 
              if qs: qs = qs + '&'
              qs = qs + sys.argv[1]
--- 130,137 ----
          else:
              qs = ''                     # Unknown content-type
!         if environ.has_key('QUERY_STRING'):
              if qs: qs = qs + '&'
              qs = qs + environ['QUERY_STRING']
!         elif sys.argv[1:]:
              if qs: qs = qs + '&'
              qs = qs + sys.argv[1]
***************
*** 156,161 ****
  
          keep_blank_values: flag indicating whether blank values in
!             URL encoded queries should be treated as blank strings.  
!             A true value indicates that blanks should be retained as 
              blank strings.  The default false value indicates that
              blank values are to be ignored and treated as if they were
--- 156,161 ----
  
          keep_blank_values: flag indicating whether blank values in
!             URL encoded queries should be treated as blank strings.
!             A true value indicates that blanks should be retained as
              blank strings.  The default false value indicates that
              blank values are to be ignored and treated as if they were
***************
*** 189,193 ****
      strict_parsing: flag indicating what to do with parsing errors. If
          false (the default), errors are silently ignored. If true,
!         errors raise a ValueError exception. 
  
      Returns a list, as G-d intended.
--- 189,193 ----
      strict_parsing: flag indicating what to do with parsing errors. If
          false (the default), errors are silently ignored. If true,
!         errors raise a ValueError exception.
  
      Returns a list, as G-d intended.
***************
*** 216,230 ****
      pdict: dictionary containing other parameters of conten-type header
  
!     Returns a dictionary just like parse_qs(): keys are the field names, each 
!     value is a list of values for that field.  This is easy to use but not 
!     much good if you are expecting megabytes to be uploaded -- in that case, 
!     use the FieldStorage class instead which is much more flexible.  Note 
!     that content-type is the raw, unparsed contents of the content-type 
      header.
!     
!     XXX This does not parse nested multipart parts -- use FieldStorage for 
      that.
!     
!     XXX This should really be subsumed by FieldStorage altogether -- no 
      point in having two implementations of the same parsing algorithm.
  
--- 216,230 ----
      pdict: dictionary containing other parameters of conten-type header
  
!     Returns a dictionary just like parse_qs(): keys are the field names, each
!     value is a list of values for that field.  This is easy to use but not
!     much good if you are expecting megabytes to be uploaded -- in that case,
!     use the FieldStorage class instead which is much more flexible.  Note
!     that content-type is the raw, unparsed contents of the content-type
      header.
! 
!     XXX This does not parse nested multipart parts -- use FieldStorage for
      that.
! 
!     XXX This should really be subsumed by FieldStorage altogether -- no
      point in having two implementations of the same parsing algorithm.
  
***************
*** 410,415 ****
  
          keep_blank_values: flag indicating whether blank values in
!             URL encoded forms should be treated as blank strings.  
!             A true value indicates that blanks should be retained as 
              blank strings.  The default false value indicates that
              blank values are to be ignored and treated as if they were
--- 410,415 ----
  
          keep_blank_values: flag indicating whether blank values in
!             URL encoded forms should be treated as blank strings.
!             A true value indicates that blanks should be retained as
              blank strings.  The default false value indicates that
              blank values are to be ignored and treated as if they were
***************
*** 708,714 ****
          import tempfile
          return tempfile.TemporaryFile("w+b")
-         
  
  
  # Backwards Compatibility Classes
  # ===============================
--- 708,714 ----
          import tempfile
          return tempfile.TemporaryFile("w+b")
  
  
+ 
  # Backwards Compatibility Classes
  # ===============================
***************
*** 745,750 ****
      """
      def __getitem__(self, key):
!         if len(self.dict[key]) > 1: 
!             raise IndexError, 'expecting a single value' 
          return self.dict[key][0]
      def getlist(self, key):
--- 745,750 ----
      """
      def __getitem__(self, key):
!         if len(self.dict[key]) > 1:
!             raise IndexError, 'expecting a single value'
          return self.dict[key][0]
      def getlist(self, key):
***************
*** 767,771 ****
  
  class InterpFormContentDict(SvFormContentDict):
!     """This class is present for backwards compatibility only.""" 
      def __getitem__(self, key):
          v = SvFormContentDict.__getitem__(self, key)
--- 767,771 ----
  
  class InterpFormContentDict(SvFormContentDict):
!     """This class is present for backwards compatibility only."""
      def __getitem__(self, key):
          v = SvFormContentDict.__getitem__(self, key)
***************
*** 795,799 ****
  
  class FormContent(FormContentDict):
!     """This class is present for backwards compatibility only.""" 
      def values(self, key):
          if self.dict.has_key(key) :return self.dict[key]
--- 795,799 ----
  
  class FormContent(FormContentDict):
!     """This class is present for backwards compatibility only."""
      def values(self, key):
          if self.dict.has_key(key) :return self.dict[key]
***************
*** 883,887 ****
      for key in keys:
          print "<DT>", escape(key), "<DD>", escape(environ[key])
!     print "</DL>" 
      print
  
--- 883,887 ----
      for key in keys:
          print "<DT>", escape(key), "<DD>", escape(environ[key])
!     print "</DL>"
      print
  
***************
*** 983,986 ****
  
  # Call test() when this file is run as a script (not imported as a module)
! if __name__ == '__main__': 
      test()
--- 983,986 ----
  
  # Call test() when this file is run as a script (not imported as a module)
! if __name__ == '__main__':
      test()

Index: chunk.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/chunk.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** chunk.py	1999/08/26 15:50:43	1.5
--- chunk.py	2001/01/14 23:36:05	1.6
***************
*** 19,23 ****
  
  Usually an IFF-type file consists of one or more chunks.  The proposed
! usage of the Chunk class defined here is to instantiate an instance at 
  the start of each chunk and read from the instance until it reaches
  the end, after which a new instance can be instantiated.  At the end
--- 19,23 ----
  
  Usually an IFF-type file consists of one or more chunks.  The proposed
! usage of the Chunk class defined here is to instantiate an instance at
  the start of each chunk and read from the instance until it reaches
  the end, after which a new instance can be instantiated.  At the end
***************
*** 45,49 ****
  The __init__ method has one required argument, a file-like object
  (including a chunk instance), and one optional argument, a flag which
! specifies whether or not chunks are aligned on 2-byte boundaries.  The 
  default is 1, i.e. aligned.
  """
--- 45,49 ----
  The __init__ method has one required argument, a file-like object
  (including a chunk instance), and one optional argument, a flag which
! specifies whether or not chunks are aligned on 2-byte boundaries.  The
  default is 1, i.e. aligned.
  """
***************
*** 53,57 ****
          import struct
          self.closed = 0
!         self.align = align	# whether to align to word (2-byte) boundaries
          if bigendian:
              strflag = '>'
--- 53,57 ----
          import struct
          self.closed = 0
!         self.align = align      # whether to align to word (2-byte) boundaries
          if bigendian:
              strflag = '>'
***************
*** 98,102 ****
          Default position is 0 (start of chunk).
          If the file is not seekable, this will result in an error.
! 	"""
  
          if self.closed:
--- 98,102 ----
          Default position is 0 (start of chunk).
          If the file is not seekable, this will result in an error.
!         """
  
          if self.closed:
***************
*** 122,126 ****
          If size is omitted or negative, read until the end
          of the chunk.
! 	"""
  
          if self.closed:
--- 122,126 ----
          If size is omitted or negative, read until the end
          of the chunk.
!         """
  
          if self.closed:
***************
*** 131,135 ****
              size = self.chunksize - self.size_read
          if size > self.chunksize - self.size_read:
!              size = self.chunksize - self.size_read
          data = self.file.read(size)
          self.size_read = self.size_read + len(data)
--- 131,135 ----
              size = self.chunksize - self.size_read
          if size > self.chunksize - self.size_read:
!             size = self.chunksize - self.size_read
          data = self.file.read(size)
          self.size_read = self.size_read + len(data)
***************
*** 146,150 ****
          this method should be called so that the file points to
          the start of the next chunk.
! 	"""
  
          if self.closed:
--- 146,150 ----
          this method should be called so that the file points to
          the start of the next chunk.
!         """
  
          if self.closed:
***************
*** 166,168 ****
              if not dummy:
                  raise EOFError
- 
--- 166,167 ----

Index: codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** codecs.py	2001/01/03 21:29:13	1.14
--- codecs.py	2001/01/14 23:36:05	1.15
***************
*** 26,34 ****
  #
  BOM_BE = BOM32_BE = '\376\377'
! #	corresponds to Unicode U+FEFF in UTF-16 on big endian
! #	platforms == ZERO WIDTH NO-BREAK SPACE
  BOM_LE = BOM32_LE = '\377\376'
! #	corresponds to Unicode U+FFFE in UTF-16 on little endian
! #	platforms == defined as being an illegal Unicode character
  
  #
--- 26,34 ----
  #
  BOM_BE = BOM32_BE = '\376\377'
! #       corresponds to Unicode U+FEFF in UTF-16 on big endian
! #       platforms == ZERO WIDTH NO-BREAK SPACE
  BOM_LE = BOM32_LE = '\377\376'
! #       corresponds to Unicode U+FFFE in UTF-16 on little endian
! #       platforms == defined as being an illegal Unicode character
  
  #
***************
*** 36,42 ****
  #
  BOM64_BE = '\000\000\376\377'
! #	corresponds to Unicode U+0000FEFF in UCS-4
  BOM64_LE = '\377\376\000\000'
! #	corresponds to Unicode U+0000FFFE in UCS-4
  
  
--- 36,42 ----
  #
  BOM64_BE = '\000\000\376\377'
! #       corresponds to Unicode U+0000FEFF in UCS-4
  BOM64_LE = '\377\376\000\000'
! #       corresponds to Unicode U+0000FFFE in UCS-4
  
  
***************
*** 548,552 ****
          Return a dictionary where elements of the rng sequence are
          mapped to themselves.
!         
      """
      res = {}
--- 548,552 ----
          Return a dictionary where elements of the rng sequence are
          mapped to themselves.
! 
      """
      res = {}

Index: commands.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/commands.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** commands.py	2000/12/12 23:20:44	1.13
--- commands.py	2001/01/14 23:36:05	1.14
***************
*** 2,8 ****
  
  Interface summary:
!  
         import commands
!         
         outtext = commands.getoutput(cmd)
         (exitstatus, outtext) = commands.getstatusoutput(cmd)
--- 2,8 ----
  
  Interface summary:
! 
         import commands
! 
         outtext = commands.getoutput(cmd)
         (exitstatus, outtext) = commands.getstatusoutput(cmd)
***************
*** 12,16 ****
  
  Encapsulates the basic operation:
!                          
        pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
        text = pipe.read()
--- 12,16 ----
  
  Encapsulates the basic operation:
! 
        pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
        text = pipe.read()

Index: copy.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** copy.py	2000/11/27 21:53:14	1.17
--- copy.py	2001/01/14 23:36:05	1.18
***************
*** 3,10 ****
  Interface summary:
  
! 	import copy
  
! 	x = copy.copy(y)	# make a shallow copy of y
! 	x = copy.deepcopy(y)	# make a deep copy of y
  
  For module specific errors, copy.error is raised.
--- 3,10 ----
  Interface summary:
  
!         import copy
  
!         x = copy.copy(y)        # make a shallow copy of y
!         x = copy.deepcopy(y)    # make a deep copy of y
  
  For module specific errors, copy.error is raised.
***************
*** 54,59 ****
  
  class Error(Exception):
! 	pass
! error = Error	# backward compatibility
  
  try:
--- 54,59 ----
  
  class Error(Exception):
!     pass
! error = Error   # backward compatibility
  
  try:
***************
*** 63,88 ****
  
  def copy(x):
! 	"""Shallow copy operation on arbitrary Python objects.
  
! 	See the module's __doc__ string for more info.
! 	"""
  
! 	try:
! 		copierfunction = _copy_dispatch[type(x)]
! 	except KeyError:
! 		try:
! 			copier = x.__copy__
! 		except AttributeError:
! 			raise error, \
! 			      "un(shallow)copyable object of type %s" % type(x)
! 		y = copier()
! 	else:
! 		y = copierfunction(x)
! 	return y
  
  _copy_dispatch = d = {}
  
  def _copy_atomic(x):
! 	return x
  d[types.NoneType] = _copy_atomic
  d[types.IntType] = _copy_atomic
--- 63,88 ----
  
  def copy(x):
!     """Shallow copy operation on arbitrary Python objects.
  
!     See the module's __doc__ string for more info.
!     """
  
!     try:
!         copierfunction = _copy_dispatch[type(x)]
!     except KeyError:
!         try:
!             copier = x.__copy__
!         except AttributeError:
!             raise error, \
!                   "un(shallow)copyable object of type %s" % type(x)
!         y = copier()
!     else:
!         y = copierfunction(x)
!     return y
  
  _copy_dispatch = d = {}
  
  def _copy_atomic(x):
!     return x
  d[types.NoneType] = _copy_atomic
  d[types.IntType] = _copy_atomic
***************
*** 92,98 ****
  d[types.UnicodeType] = _copy_atomic
  try:
! 	d[types.CodeType] = _copy_atomic
  except AttributeError:
! 	pass
  d[types.TypeType] = _copy_atomic
  d[types.XRangeType] = _copy_atomic
--- 92,98 ----
  d[types.UnicodeType] = _copy_atomic
  try:
!     d[types.CodeType] = _copy_atomic
  except AttributeError:
!     pass
  d[types.TypeType] = _copy_atomic
  d[types.XRangeType] = _copy_atomic
***************
*** 100,112 ****
  
  def _copy_list(x):
! 	return x[:]
  d[types.ListType] = _copy_list
  
  def _copy_tuple(x):
! 	return x[:]
  d[types.TupleType] = _copy_tuple
  
  def _copy_dict(x):
! 	return x.copy()
  d[types.DictionaryType] = _copy_dict
  if PyStringMap is not None:
--- 100,112 ----
  
  def _copy_list(x):
!     return x[:]
  d[types.ListType] = _copy_list
  
  def _copy_tuple(x):
!     return x[:]
  d[types.TupleType] = _copy_tuple
  
  def _copy_dict(x):
!     return x.copy()
  d[types.DictionaryType] = _copy_dict
  if PyStringMap is not None:
***************
*** 114,134 ****
  
  def _copy_inst(x):
! 	if hasattr(x, '__copy__'):
! 		return x.__copy__()
! 	if hasattr(x, '__getinitargs__'):
! 		args = x.__getinitargs__()
! 		y = apply(x.__class__, args)
! 	else:
! 		y = _EmptyClass()
! 		y.__class__ = x.__class__
! 	if hasattr(x, '__getstate__'):
! 		state = x.__getstate__()
! 	else:
! 		state = x.__dict__
! 	if hasattr(y, '__setstate__'):
! 		y.__setstate__(state)
! 	else:
! 		y.__dict__.update(state)
! 	return y
  d[types.InstanceType] = _copy_inst
  
--- 114,134 ----
  
  def _copy_inst(x):
!     if hasattr(x, '__copy__'):
!         return x.__copy__()
!     if hasattr(x, '__getinitargs__'):
!         args = x.__getinitargs__()
!         y = apply(x.__class__, args)
!     else:
!         y = _EmptyClass()
!         y.__class__ = x.__class__
!     if hasattr(x, '__getstate__'):
!         state = x.__getstate__()
!     else:
!         state = x.__dict__
!     if hasattr(y, '__setstate__'):
!         y.__setstate__(state)
!     else:
!         y.__dict__.update(state)
!     return y
  d[types.InstanceType] = _copy_inst
  
***************
*** 136,167 ****
  
  def deepcopy(x, memo = None):
! 	"""Deep copy operation on arbitrary Python objects.
  
! 	See the module's __doc__ string for more info.
! 	"""
  
! 	if memo is None:
! 		memo = {}
! 	d = id(x)
! 	if memo.has_key(d):
! 		return memo[d]
! 	try:
! 		copierfunction = _deepcopy_dispatch[type(x)]
! 	except KeyError:
! 		try:
! 			copier = x.__deepcopy__
! 		except AttributeError:
! 			raise error, \
! 			      "un-deep-copyable object of type %s" % type(x)
! 		y = copier(memo)
! 	else:
! 		y = copierfunction(x, memo)
! 	memo[d] = y
! 	return y
  
  _deepcopy_dispatch = d = {}
  
  def _deepcopy_atomic(x, memo):
! 	return x
  d[types.NoneType] = _deepcopy_atomic
  d[types.IntType] = _deepcopy_atomic
--- 136,167 ----
  
  def deepcopy(x, memo = None):
!     """Deep copy operation on arbitrary Python objects.
  
!     See the module's __doc__ string for more info.
!     """
  
!     if memo is None:
!         memo = {}
!     d = id(x)
!     if memo.has_key(d):
!         return memo[d]
!     try:
!         copierfunction = _deepcopy_dispatch[type(x)]
!     except KeyError:
!         try:
!             copier = x.__deepcopy__
!         except AttributeError:
!             raise error, \
!                   "un-deep-copyable object of type %s" % type(x)
!         y = copier(memo)
!     else:
!         y = copierfunction(x, memo)
!     memo[d] = y
!     return y
  
  _deepcopy_dispatch = d = {}
  
  def _deepcopy_atomic(x, memo):
!     return x
  d[types.NoneType] = _deepcopy_atomic
  d[types.IntType] = _deepcopy_atomic
***************
*** 175,210 ****
  
  def _deepcopy_list(x, memo):
! 	y = []
! 	memo[id(x)] = y
! 	for a in x:
! 		y.append(deepcopy(a, memo))
! 	return y
  d[types.ListType] = _deepcopy_list
  
  def _deepcopy_tuple(x, memo):
! 	y = []
! 	for a in x:
! 		y.append(deepcopy(a, memo))
! 	d = id(x)
! 	try:
! 		return memo[d]
! 	except KeyError:
! 		pass
! 	for i in range(len(x)):
! 		if x[i] is not y[i]:
! 			y = tuple(y)
! 			break
! 	else:
! 		y = x
! 	memo[d] = y
! 	return y
  d[types.TupleType] = _deepcopy_tuple
  
  def _deepcopy_dict(x, memo):
! 	y = {}
! 	memo[id(x)] = y
! 	for key in x.keys():
! 		y[deepcopy(key, memo)] = deepcopy(x[key], memo)
! 	return y
  d[types.DictionaryType] = _deepcopy_dict
  if PyStringMap is not None:
--- 175,210 ----
  
  def _deepcopy_list(x, memo):
!     y = []
!     memo[id(x)] = y
!     for a in x:
!         y.append(deepcopy(a, memo))
!     return y
  d[types.ListType] = _deepcopy_list
  
  def _deepcopy_tuple(x, memo):
!     y = []
!     for a in x:
!         y.append(deepcopy(a, memo))
!     d = id(x)
!     try:
!         return memo[d]
!     except KeyError:
!         pass
!     for i in range(len(x)):
!         if x[i] is not y[i]:
!             y = tuple(y)
!             break
!     else:
!         y = x
!     memo[d] = y
!     return y
  d[types.TupleType] = _deepcopy_tuple
  
  def _deepcopy_dict(x, memo):
!     y = {}
!     memo[id(x)] = y
!     for key in x.keys():
!         y[deepcopy(key, memo)] = deepcopy(x[key], memo)
!     return y
  d[types.DictionaryType] = _deepcopy_dict
  if PyStringMap is not None:
***************
*** 212,253 ****
  
  def _keep_alive(x, memo):
! 	"""Keeps a reference to the object x in the memo.
  
! 	Because we remember objects by their id, we have
! 	to assure that possibly temporary objects are kept
! 	alive by referencing them.
! 	We store a reference at the id of the memo, which should
! 	normally not be used unless someone tries to deepcopy
! 	the memo itself...
! 	"""
! 	try:
! 		memo[id(memo)].append(x)
! 	except KeyError:
! 		# aha, this is the first one :-)
! 		memo[id(memo)]=[x]
  
  def _deepcopy_inst(x, memo):
! 	if hasattr(x, '__deepcopy__'):
! 		return x.__deepcopy__(memo)
! 	if hasattr(x, '__getinitargs__'):
! 		args = x.__getinitargs__()
! 		_keep_alive(args, memo)
! 		args = deepcopy(args, memo)
! 		y = apply(x.__class__, args)
! 	else:
! 		y = _EmptyClass()
! 		y.__class__ = x.__class__
! 	memo[id(x)] = y
! 	if hasattr(x, '__getstate__'):
! 		state = x.__getstate__()
! 		_keep_alive(state, memo)
! 	else:
! 		state = x.__dict__
! 	state = deepcopy(state, memo)
! 	if hasattr(y, '__setstate__'):
! 		y.__setstate__(state)
! 	else:
! 		y.__dict__.update(state)
! 	return y
  d[types.InstanceType] = _deepcopy_inst
  
--- 212,253 ----
  
  def _keep_alive(x, memo):
!     """Keeps a reference to the object x in the memo.
  
!     Because we remember objects by their id, we have
!     to assure that possibly temporary objects are kept
!     alive by referencing them.
!     We store a reference at the id of the memo, which should
!     normally not be used unless someone tries to deepcopy
!     the memo itself...
!     """
!     try:
!         memo[id(memo)].append(x)
!     except KeyError:
!         # aha, this is the first one :-)
!         memo[id(memo)]=[x]
  
  def _deepcopy_inst(x, memo):
!     if hasattr(x, '__deepcopy__'):
!         return x.__deepcopy__(memo)
!     if hasattr(x, '__getinitargs__'):
!         args = x.__getinitargs__()
!         _keep_alive(args, memo)
!         args = deepcopy(args, memo)
!         y = apply(x.__class__, args)
!     else:
!         y = _EmptyClass()
!         y.__class__ = x.__class__
!     memo[id(x)] = y
!     if hasattr(x, '__getstate__'):
!         state = x.__getstate__()
!         _keep_alive(state, memo)
!     else:
!         state = x.__dict__
!     state = deepcopy(state, memo)
!     if hasattr(y, '__setstate__'):
!         y.__setstate__(state)
!     else:
!         y.__dict__.update(state)
!     return y
  d[types.InstanceType] = _deepcopy_inst
  
***************
*** 261,316 ****
  
  def _test():
! 	l = [None, 1, 2L, 3.14, 'xyzzy', (1, 2L), [3.14, 'abc'],
! 	     {'abc': 'ABC'}, (), [], {}]
! 	l1 = copy(l)
! 	print l1==l
! 	l1 = map(copy, l)
! 	print l1==l
! 	l1 = deepcopy(l)
! 	print l1==l
! 	class C:
! 		def __init__(self, arg=None):
! 			self.a = 1
! 			self.arg = arg
! 			if __name__ == '__main__':
! 				import sys
! 				file = sys.argv[0]
! 			else:
! 				file = __file__
! 			self.fp = open(file)
! 			self.fp.close()
! 		def __getstate__(self):
! 			return {'a': self.a, 'arg': self.arg}
! 		def __setstate__(self, state):
! 			for key in state.keys():
! 				setattr(self, key, state[key])
! 		def __deepcopy__(self, memo = None):
! 			new = self.__class__(deepcopy(self.arg, memo))
! 			new.a = self.a
! 			return new
! 	c = C('argument sketch')
! 	l.append(c)
! 	l2 = copy(l)
! 	print l == l2
! 	print l
! 	print l2
! 	l2 = deepcopy(l)
! 	print l == l2
! 	print l
! 	print l2
! 	l.append({l[1]: l, 'xyz': l[2]})
! 	l3 = copy(l)
! 	import repr
! 	print map(repr.repr, l)
! 	print map(repr.repr, l1)
! 	print map(repr.repr, l2)
! 	print map(repr.repr, l3)
! 	l3 = deepcopy(l)
! 	import repr
! 	print map(repr.repr, l)
! 	print map(repr.repr, l1)
! 	print map(repr.repr, l2)
! 	print map(repr.repr, l3)
  
  if __name__ == '__main__':
! 	_test()
--- 261,316 ----
  
  def _test():
!     l = [None, 1, 2L, 3.14, 'xyzzy', (1, 2L), [3.14, 'abc'],
!          {'abc': 'ABC'}, (), [], {}]
!     l1 = copy(l)
!     print l1==l
!     l1 = map(copy, l)
!     print l1==l
!     l1 = deepcopy(l)
!     print l1==l
!     class C:
!         def __init__(self, arg=None):
!             self.a = 1
!             self.arg = arg
!             if __name__ == '__main__':
!                 import sys
!                 file = sys.argv[0]
!             else:
!                 file = __file__
!             self.fp = open(file)
!             self.fp.close()
!         def __getstate__(self):
!             return {'a': self.a, 'arg': self.arg}
!         def __setstate__(self, state):
!             for key in state.keys():
!                 setattr(self, key, state[key])
!         def __deepcopy__(self, memo = None):
!             new = self.__class__(deepcopy(self.arg, memo))
!             new.a = self.a
!             return new
!     c = C('argument sketch')
!     l.append(c)
!     l2 = copy(l)
!     print l == l2
!     print l
!     print l2
!     l2 = deepcopy(l)
!     print l == l2
!     print l
!     print l2
!     l.append({l[1]: l, 'xyz': l[2]})
!     l3 = copy(l)
!     import repr
!     print map(repr.repr, l)
!     print map(repr.repr, l1)
!     print map(repr.repr, l2)
!     print map(repr.repr, l3)
!     l3 = deepcopy(l)
!     import repr
!     print map(repr.repr, l)
!     print map(repr.repr, l1)
!     print map(repr.repr, l2)
!     print map(repr.repr, l3)
  
  if __name__ == '__main__':
!     _test()

Index: dis.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** dis.py	2000/08/24 22:44:53	1.27
--- dis.py	2001/01/14 23:36:05	1.28
***************
*** 6,118 ****
  
  def dis(x=None):
! 	"""Disassemble classes, methods, functions, or code.
  
! 	With no argument, disassemble the last traceback.
  
! 	"""
! 	if not x:
! 		distb()
! 		return
! 	if type(x) is types.InstanceType:
! 		x = x.__class__
! 	if hasattr(x, '__dict__'):
! 		items = x.__dict__.items()
! 		items.sort()
! 		for name, x1 in items:
! 			if type(x1) in (types.MethodType,
! 					types.FunctionType,
! 					types.CodeType):
! 				print "Disassembly of %s:" % name
! 				try:
! 					dis(x1)
! 				except TypeError, msg:
! 					print "Sorry:", msg
! 				print
! 	else:
! 		if hasattr(x, 'im_func'):
! 			x = x.im_func
! 		if hasattr(x, 'func_code'):
! 			x = x.func_code
! 		if hasattr(x, 'co_code'):
! 			disassemble(x)
! 		else:
! 			raise TypeError, \
! 			      "don't know how to disassemble %s objects" % \
! 			      type(x).__name__
  
  def distb(tb=None):
! 	"""Disassemble a traceback (default: last traceback)."""
! 	if not tb:
! 		try:
! 			tb = sys.last_traceback
! 		except AttributeError:
! 			raise RuntimeError, "no last traceback to disassemble"
! 		while tb.tb_next: tb = tb.tb_next
! 	disassemble(tb.tb_frame.f_code, tb.tb_lasti)
  
  def disassemble(co, lasti=-1):
! 	"""Disassemble a code object."""
! 	code = co.co_code
! 	labels = findlabels(code)
! 	n = len(code)
! 	i = 0
! 	extended_arg = 0
! 	while i < n:
! 		c = code[i]
! 		op = ord(c)
! 		if op == SET_LINENO and i > 0: print # Extra blank line
! 		if i == lasti: print '-->',
! 		else: print '   ',
! 		if i in labels: print '>>',
! 		else: print '  ',
! 		print string.rjust(`i`, 4),
! 		print string.ljust(opname[op], 20),
! 		i = i+1
! 		if op >= HAVE_ARGUMENT:
! 			oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg
! 			extended_arg = 0
! 			i = i+2
! 			if op == EXTENDED_ARG:
! 				extended_arg = oparg*65536L
! 			print string.rjust(`oparg`, 5),
! 			if op in hasconst:
! 				print '(' + `co.co_consts[oparg]` + ')',
! 			elif op in hasname:
! 				print '(' + co.co_names[oparg] + ')',
! 			elif op in hasjrel:
! 				print '(to ' + `i + oparg` + ')',
! 			elif op in haslocal:
! 				print '(' + co.co_varnames[oparg] + ')',
! 			elif op in hascompare:
! 				print '(' + cmp_op[oparg] + ')',
! 		print
  
! disco = disassemble			# XXX For backwards compatibility
  
  def findlabels(code):
! 	"""Detect all offsets in a byte code which are jump targets.
  
! 	Return the list of offsets.
  
! 	"""
! 	labels = []
! 	n = len(code)
! 	i = 0
! 	while i < n:
! 		c = code[i]
! 		op = ord(c)
! 		i = i+1
! 		if op >= HAVE_ARGUMENT:
! 			oparg = ord(code[i]) + ord(code[i+1])*256
! 			i = i+2
! 			label = -1
! 			if op in hasjrel:
! 				label = i+oparg
! 			elif op in hasjabs:
! 				label = oparg
! 			if label >= 0:
! 				if label not in labels:
! 					labels.append(label)
! 	return labels
  
  cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',
--- 6,118 ----
  
  def dis(x=None):
!     """Disassemble classes, methods, functions, or code.
  
!     With no argument, disassemble the last traceback.
  
!     """
!     if not x:
!         distb()
!         return
!     if type(x) is types.InstanceType:
!         x = x.__class__
!     if hasattr(x, '__dict__'):
!         items = x.__dict__.items()
!         items.sort()
!         for name, x1 in items:
!             if type(x1) in (types.MethodType,
!                             types.FunctionType,
!                             types.CodeType):
!                 print "Disassembly of %s:" % name
!                 try:
!                     dis(x1)
!                 except TypeError, msg:
!                     print "Sorry:", msg
!                 print
!     else:
!         if hasattr(x, 'im_func'):
!             x = x.im_func
!         if hasattr(x, 'func_code'):
!             x = x.func_code
!         if hasattr(x, 'co_code'):
!             disassemble(x)
!         else:
!             raise TypeError, \
!                   "don't know how to disassemble %s objects" % \
!                   type(x).__name__
  
  def distb(tb=None):
!     """Disassemble a traceback (default: last traceback)."""
!     if not tb:
!         try:
!             tb = sys.last_traceback
!         except AttributeError:
!             raise RuntimeError, "no last traceback to disassemble"
!         while tb.tb_next: tb = tb.tb_next
!     disassemble(tb.tb_frame.f_code, tb.tb_lasti)
  
  def disassemble(co, lasti=-1):
!     """Disassemble a code object."""
!     code = co.co_code
!     labels = findlabels(code)
!     n = len(code)
!     i = 0
!     extended_arg = 0
!     while i < n:
!         c = code[i]
!         op = ord(c)
!         if op == SET_LINENO and i > 0: print # Extra blank line
!         if i == lasti: print '-->',
!         else: print '   ',
!         if i in labels: print '>>',
!         else: print '  ',
!         print string.rjust(`i`, 4),
!         print string.ljust(opname[op], 20),
!         i = i+1
!         if op >= HAVE_ARGUMENT:
!             oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg
!             extended_arg = 0
!             i = i+2
!             if op == EXTENDED_ARG:
!                 extended_arg = oparg*65536L
!             print string.rjust(`oparg`, 5),
!             if op in hasconst:
!                 print '(' + `co.co_consts[oparg]` + ')',
!             elif op in hasname:
!                 print '(' + co.co_names[oparg] + ')',
!             elif op in hasjrel:
!                 print '(to ' + `i + oparg` + ')',
!             elif op in haslocal:
!                 print '(' + co.co_varnames[oparg] + ')',
!             elif op in hascompare:
!                 print '(' + cmp_op[oparg] + ')',
!         print
  
! disco = disassemble                     # XXX For backwards compatibility
  
  def findlabels(code):
!     """Detect all offsets in a byte code which are jump targets.
  
!     Return the list of offsets.
  
!     """
!     labels = []
!     n = len(code)
!     i = 0
!     while i < n:
!         c = code[i]
!         op = ord(c)
!         i = i+1
!         if op >= HAVE_ARGUMENT:
!             oparg = ord(code[i]) + ord(code[i+1])*256
!             i = i+2
!             label = -1
!             if op in hasjrel:
!                 label = i+oparg
!             elif op in hasjabs:
!                 label = oparg
!             if label >= 0:
!                 if label not in labels:
!                     labels.append(label)
!     return labels
  
  cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',
***************
*** 130,146 ****
  
  def def_op(name, op):
! 	opname[op] = name
  
  def name_op(name, op):
! 	opname[op] = name
! 	hasname.append(op)
  
  def jrel_op(name, op):
! 	opname[op] = name
! 	hasjrel.append(op)
  
  def jabs_op(name, op):
! 	opname[op] = name
! 	hasjabs.append(op)
  
  # Instruction opcodes for compiled code
--- 130,146 ----
  
  def def_op(name, op):
!     opname[op] = name
  
  def name_op(name, op):
!     opname[op] = name
!     hasname.append(op)
  
  def jrel_op(name, op):
!     opname[op] = name
!     hasjrel.append(op)
  
  def jabs_op(name, op):
!     opname[op] = name
!     hasjabs.append(op)
  
  # Instruction opcodes for compiled code
***************
*** 220,266 ****
  def_op('BUILD_CLASS', 89)
  
! HAVE_ARGUMENT = 90		# Opcodes from here have an argument: 
  
! name_op('STORE_NAME', 90)	# Index in name list 
! name_op('DELETE_NAME', 91)	# "" 
! def_op('UNPACK_SEQUENCE', 92)	# Number of tuple items 
! 
! name_op('STORE_ATTR', 95)	# Index in name list 
! name_op('DELETE_ATTR', 96)	# ""
! name_op('STORE_GLOBAL', 97)	# ""
! name_op('DELETE_GLOBAL', 98)	# ""
! def_op('DUP_TOPX', 99)		# number of items to duplicate
! def_op('LOAD_CONST', 100)	# Index in const list 
  hasconst.append(100)
! name_op('LOAD_NAME', 101)	# Index in name list 
! def_op('BUILD_TUPLE', 102)	# Number of tuple items 
! def_op('BUILD_LIST', 103)	# Number of list items 
! def_op('BUILD_MAP', 104)	# Always zero for now 
! name_op('LOAD_ATTR', 105)	# Index in name list 
! def_op('COMPARE_OP', 106)	# Comparison operator 
  hascompare.append(106)
! name_op('IMPORT_NAME', 107)	# Index in name list 
! name_op('IMPORT_FROM', 108)	# Index in name list 
  
! jrel_op('JUMP_FORWARD', 110)	# Number of bytes to skip 
! jrel_op('JUMP_IF_FALSE', 111)	# "" 
! jrel_op('JUMP_IF_TRUE', 112)	# "" 
! jabs_op('JUMP_ABSOLUTE', 113)	# Target byte offset from beginning of code 
! jrel_op('FOR_LOOP', 114)	# Number of bytes to skip 
! 
! name_op('LOAD_GLOBAL', 116)	# Index in name list
! 
! jrel_op('SETUP_LOOP', 120)	# Distance to target address
! jrel_op('SETUP_EXCEPT', 121)	# ""
! jrel_op('SETUP_FINALLY', 122)	# ""
  
! def_op('LOAD_FAST', 124)	# Local variable number
  haslocal.append(124)
! def_op('STORE_FAST', 125)	# Local variable number
  haslocal.append(125)
! def_op('DELETE_FAST', 126)	# Local variable number
  haslocal.append(126)
  
! def_op('SET_LINENO', 127)	# Current line number
  SET_LINENO = 127
  
--- 220,266 ----
  def_op('BUILD_CLASS', 89)
  
! HAVE_ARGUMENT = 90              # Opcodes from here have an argument:
  
! name_op('STORE_NAME', 90)       # Index in name list
! name_op('DELETE_NAME', 91)      # ""
! def_op('UNPACK_SEQUENCE', 92)   # Number of tuple items
! 
! name_op('STORE_ATTR', 95)       # Index in name list
! name_op('DELETE_ATTR', 96)      # ""
! name_op('STORE_GLOBAL', 97)     # ""
! name_op('DELETE_GLOBAL', 98)    # ""
! def_op('DUP_TOPX', 99)          # number of items to duplicate
! def_op('LOAD_CONST', 100)       # Index in const list
  hasconst.append(100)
! name_op('LOAD_NAME', 101)       # Index in name list
! def_op('BUILD_TUPLE', 102)      # Number of tuple items
! def_op('BUILD_LIST', 103)       # Number of list items
! def_op('BUILD_MAP', 104)        # Always zero for now
! name_op('LOAD_ATTR', 105)       # Index in name list
! def_op('COMPARE_OP', 106)       # Comparison operator
  hascompare.append(106)
! name_op('IMPORT_NAME', 107)     # Index in name list
! name_op('IMPORT_FROM', 108)     # Index in name list
  
! jrel_op('JUMP_FORWARD', 110)    # Number of bytes to skip
! jrel_op('JUMP_IF_FALSE', 111)   # ""
! jrel_op('JUMP_IF_TRUE', 112)    # ""
! jabs_op('JUMP_ABSOLUTE', 113)   # Target byte offset from beginning of code
! jrel_op('FOR_LOOP', 114)        # Number of bytes to skip
! 
! name_op('LOAD_GLOBAL', 116)     # Index in name list
! 
! jrel_op('SETUP_LOOP', 120)      # Distance to target address
! jrel_op('SETUP_EXCEPT', 121)    # ""
! jrel_op('SETUP_FINALLY', 122)   # ""
  
! def_op('LOAD_FAST', 124)        # Local variable number
  haslocal.append(124)
! def_op('STORE_FAST', 125)       # Local variable number
  haslocal.append(125)
! def_op('DELETE_FAST', 126)      # Local variable number
  haslocal.append(126)
  
! def_op('SET_LINENO', 127)       # Current line number
  SET_LINENO = 127
  
***************
*** 274,303 ****
  def_op('CALL_FUNCTION_VAR_KW', 142)  # #args + (#kwargs << 8)
  
! def_op('EXTENDED_ARG', 143) 
  EXTENDED_ARG = 143
  
  def _test():
! 	"""Simple test program to disassemble a file."""
! 	if sys.argv[1:]:
! 		if sys.argv[2:]:
! 			sys.stderr.write("usage: python dis.py [-|file]\n")
! 			sys.exit(2)
! 		fn = sys.argv[1]
! 		if not fn or fn == "-":
! 			fn = None
! 	else:
! 		fn = None
! 	if not fn:
! 		f = sys.stdin
! 	else:
! 		f = open(fn)
! 	source = f.read()
! 	if fn:
! 		f.close()
! 	else:
! 		fn = "<stdin>"
! 	code = compile(source, fn, "exec")
! 	dis(code)
  
  if __name__ == "__main__":
! 	_test()
--- 274,303 ----
  def_op('CALL_FUNCTION_VAR_KW', 142)  # #args + (#kwargs << 8)
  
! def_op('EXTENDED_ARG', 143)
  EXTENDED_ARG = 143
  
  def _test():
!     """Simple test program to disassemble a file."""
!     if sys.argv[1:]:
!         if sys.argv[2:]:
!             sys.stderr.write("usage: python dis.py [-|file]\n")
!             sys.exit(2)
!         fn = sys.argv[1]
!         if not fn or fn == "-":
!             fn = None
!     else:
!         fn = None
!     if not fn:
!         f = sys.stdin
!     else:
!         f = open(fn)
!     source = f.read()
!     if fn:
!         f.close()
!     else:
!         fn = "<stdin>"
!     code = compile(source, fn, "exec")
!     dis(code)
  
  if __name__ == "__main__":
!     _test()

Index: dospath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dospath.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** dospath.py	2000/12/12 23:20:44	1.20
--- dospath.py	2001/01/14 23:36:05	1.21
***************
*** 11,16 ****
      Other normalizations (such as optimizing '../' away) are not allowed
      (this is done by normpath).
!     Previously, this version mapped invalid consecutive characters to a 
!     single '_', but this has been removed.  This functionality should 
      possibly be added as a new function."""
  
--- 11,16 ----
      Other normalizations (such as optimizing '../' away) are not allowed
      (this is done by normpath).
!     Previously, this version mapped invalid consecutive characters to a
!     single '_', but this has been removed.  This functionality should
      possibly be added as a new function."""
  

Index: dumbdbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** dumbdbm.py	2000/12/11 20:33:52	1.6
--- dumbdbm.py	2001/01/14 23:36:05	1.7
***************
*** 29,144 ****
  _BLOCKSIZE = 512
  
! error = IOError				# For anydbm
  
  class _Database:
  
! 	def __init__(self, file):
! 		self._dirfile = file + '.dir'
! 		self._datfile = file + '.dat'
! 		self._bakfile = file + '.bak'
! 		# Mod by Jack: create data file if needed
! 		try:
! 			f = _open(self._datfile, 'r')
! 		except IOError:
! 			f = _open(self._datfile, 'w')
! 		f.close()
! 		self._update()
! 	
! 	def _update(self):
! 		self._index = {}
! 		try:
! 			f = _open(self._dirfile)
! 		except IOError:
! 			pass
! 		else:
! 			while 1:
! 				line = f.readline().rstrip()
! 				if not line: break
! 				key, (pos, siz) = eval(line)
! 				self._index[key] = (pos, siz)
! 			f.close()
! 
! 	def _commit(self):
! 		try: _os.unlink(self._bakfile)
! 		except _os.error: pass
! 		try: _os.rename(self._dirfile, self._bakfile)
! 		except _os.error: pass
! 		f = _open(self._dirfile, 'w')
! 		for key, (pos, siz) in self._index.items():
! 			f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`))
! 		f.close()
! 	
! 	def __getitem__(self, key):
! 		pos, siz = self._index[key]	# may raise KeyError
! 		f = _open(self._datfile, 'rb')
! 		f.seek(pos)
! 		dat = f.read(siz)
! 		f.close()
! 		return dat
! 	
! 	def _addval(self, val):
! 		f = _open(self._datfile, 'rb+')
! 		f.seek(0, 2)
! 		pos = int(f.tell())
  ## Does not work under MW compiler
! ##		pos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
! ##		f.seek(pos)
! 		npos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
! 		f.write('\0'*(npos-pos))
! 		pos = npos
! 		
! 		f.write(val)
! 		f.close()
! 		return (pos, len(val))
! 	
! 	def _setval(self, pos, val):
! 		f = _open(self._datfile, 'rb+')
! 		f.seek(pos)
! 		f.write(val)
! 		f.close()
! 		return (pos, len(val))
! 	
! 	def _addkey(self, key, (pos, siz)):
! 		self._index[key] = (pos, siz)
! 		f = _open(self._dirfile, 'a')
! 		f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`))
! 		f.close()
! 	
! 	def __setitem__(self, key, val):
! 		if not type(key) == type('') == type(val):
! 			raise TypeError, "keys and values must be strings"
! 		if not self._index.has_key(key):
! 			(pos, siz) = self._addval(val)
! 			self._addkey(key, (pos, siz))
! 		else:
! 			pos, siz = self._index[key]
! 			oldblocks = (siz + _BLOCKSIZE - 1) / _BLOCKSIZE
! 			newblocks = (len(val) + _BLOCKSIZE - 1) / _BLOCKSIZE
! 			if newblocks <= oldblocks:
! 				pos, siz = self._setval(pos, val)
! 				self._index[key] = pos, siz
! 			else:
! 				pos, siz = self._addval(val)
! 				self._index[key] = pos, siz
! 	
! 	def __delitem__(self, key):
! 		del self._index[key]
! 		self._commit()
! 	
! 	def keys(self):
! 		return self._index.keys()
! 	
! 	def has_key(self, key):
! 		return self._index.has_key(key)
! 	
! 	def __len__(self):
! 		return len(self._index)
! 	
! 	def close(self):
! 		self._index = None
! 		self._datfile = self._dirfile = self._bakfile = None
  
  
  def open(file, flag = None, mode = None):
! 	# flag, mode arguments are currently ignored
! 	return _Database(file)
--- 29,144 ----
  _BLOCKSIZE = 512
  
! error = IOError                         # For anydbm
  
  class _Database:
  
!     def __init__(self, file):
!         self._dirfile = file + '.dir'
!         self._datfile = file + '.dat'
!         self._bakfile = file + '.bak'
!         # Mod by Jack: create data file if needed
!         try:
!             f = _open(self._datfile, 'r')
!         except IOError:
!             f = _open(self._datfile, 'w')
!         f.close()
!         self._update()
! 
!     def _update(self):
!         self._index = {}
!         try:
!             f = _open(self._dirfile)
!         except IOError:
!             pass
!         else:
!             while 1:
!                 line = f.readline().rstrip()
!                 if not line: break
!                 key, (pos, siz) = eval(line)
!                 self._index[key] = (pos, siz)
!             f.close()
! 
!     def _commit(self):
!         try: _os.unlink(self._bakfile)
!         except _os.error: pass
!         try: _os.rename(self._dirfile, self._bakfile)
!         except _os.error: pass
!         f = _open(self._dirfile, 'w')
!         for key, (pos, siz) in self._index.items():
!             f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`))
!         f.close()
! 
!     def __getitem__(self, key):
!         pos, siz = self._index[key]     # may raise KeyError
!         f = _open(self._datfile, 'rb')
!         f.seek(pos)
!         dat = f.read(siz)
!         f.close()
!         return dat
! 
!     def _addval(self, val):
!         f = _open(self._datfile, 'rb+')
!         f.seek(0, 2)
!         pos = int(f.tell())
  ## Does not work under MW compiler
! ##              pos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
! ##              f.seek(pos)
!         npos = ((pos + _BLOCKSIZE - 1) / _BLOCKSIZE) * _BLOCKSIZE
!         f.write('\0'*(npos-pos))
!         pos = npos
! 
!         f.write(val)
!         f.close()
!         return (pos, len(val))
! 
!     def _setval(self, pos, val):
!         f = _open(self._datfile, 'rb+')
!         f.seek(pos)
!         f.write(val)
!         f.close()
!         return (pos, len(val))
! 
!     def _addkey(self, key, (pos, siz)):
!         self._index[key] = (pos, siz)
!         f = _open(self._dirfile, 'a')
!         f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`))
!         f.close()
! 
!     def __setitem__(self, key, val):
!         if not type(key) == type('') == type(val):
!             raise TypeError, "keys and values must be strings"
!         if not self._index.has_key(key):
!             (pos, siz) = self._addval(val)
!             self._addkey(key, (pos, siz))
!         else:
!             pos, siz = self._index[key]
!             oldblocks = (siz + _BLOCKSIZE - 1) / _BLOCKSIZE
!             newblocks = (len(val) + _BLOCKSIZE - 1) / _BLOCKSIZE
!             if newblocks <= oldblocks:
!                 pos, siz = self._setval(pos, val)
!                 self._index[key] = pos, siz
!             else:
!                 pos, siz = self._addval(val)
!                 self._index[key] = pos, siz
! 
!     def __delitem__(self, key):
!         del self._index[key]
!         self._commit()
! 
!     def keys(self):
!         return self._index.keys()
! 
!     def has_key(self, key):
!         return self._index.has_key(key)
! 
!     def __len__(self):
!         return len(self._index)
! 
!     def close(self):
!         self._index = None
!         self._datfile = self._dirfile = self._bakfile = None
  
  
  def open(file, flag = None, mode = None):
!     # flag, mode arguments are currently ignored
!     return _Database(file)

Index: filecmp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/filecmp.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** filecmp.py	2000/12/12 23:20:44	1.8
--- filecmp.py	2001/01/14 23:36:05	1.9
***************
*** 292,298 ****
  # Compare two files.
  # Return:
! #	0 for equal
! #	1 for different
! #	2 for funny cases (can't stat, etc.)
  #
  def _cmp(a, b, sh, st):
--- 292,298 ----
  # Compare two files.
  # Return:
! #       0 for equal
! #       1 for different
! #       2 for funny cases (can't stat, etc.)
  #
  def _cmp(a, b, sh, st):

Index: fnmatch.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/fnmatch.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** fnmatch.py	2000/06/28 14:48:01	1.8
--- fnmatch.py	2001/01/14 23:36:05	1.9
***************
*** 16,89 ****
  
  def fnmatch(name, pat):
! 	"""Test whether FILENAME matches PATTERN.
! 	
! 	Patterns are Unix shell style:
! 	
! 	*	matches everything
! 	?	matches any single character
! 	[seq]	matches any character in seq
! 	[!seq]	matches any char not in seq
! 	
! 	An initial period in FILENAME is not special.
! 	Both FILENAME and PATTERN are first case-normalized
! 	if the operating system requires it.
! 	If you don't want this, use fnmatchcase(FILENAME, PATTERN).
! 	"""
! 	
! 	import os
! 	name = os.path.normcase(name)
! 	pat = os.path.normcase(pat)
! 	return fnmatchcase(name, pat)
  
  def fnmatchcase(name, pat):
! 	"""Test whether FILENAME matches PATTERN, including case.
! 	
! 	This is a version of fnmatch() which doesn't case-normalize
! 	its arguments.
! 	"""
! 	
! 	if not _cache.has_key(pat):
! 		res = translate(pat)
! 		_cache[pat] = re.compile(res)
! 	return _cache[pat].match(name) is not None
  
  def translate(pat):
! 	"""Translate a shell PATTERN to a regular expression.
! 	
! 	There is no way to quote meta-characters.
! 	"""
! 	
! 	i, n = 0, len(pat)
! 	res = ''
! 	while i < n:
! 		c = pat[i]
! 		i = i+1
! 		if c == '*':
! 			res = res + '.*'
! 		elif c == '?':
! 			res = res + '.'
! 		elif c == '[':
! 			j = i
! 			if j < n and pat[j] == '!':
! 				j = j+1
! 			if j < n and pat[j] == ']':
! 				j = j+1
! 			while j < n and pat[j] != ']':
! 				j = j+1
! 			if j >= n:
! 				res = res + '\\['
! 			else:
! 				stuff = pat[i:j]
! 				i = j+1
! 				if stuff[0] == '!':
! 					stuff = '[^' + stuff[1:] + ']'
! 				elif stuff == '^'*len(stuff):
! 					stuff = '\\^'
! 				else:
! 					while stuff[0] == '^':
! 						stuff = stuff[1:] + stuff[0]
! 					stuff = '[' + stuff + ']'
! 				res = res + stuff
! 		else:
! 			res = res + re.escape(c)
! 	return res + "$"
--- 16,89 ----
  
  def fnmatch(name, pat):
!     """Test whether FILENAME matches PATTERN.
  
+     Patterns are Unix shell style:
+ 
+     *       matches everything
+     ?       matches any single character
+     [seq]   matches any character in seq
+     [!seq]  matches any char not in seq
+ 
+     An initial period in FILENAME is not special.
+     Both FILENAME and PATTERN are first case-normalized
+     if the operating system requires it.
+     If you don't want this, use fnmatchcase(FILENAME, PATTERN).
+     """
+ 
+     import os
+     name = os.path.normcase(name)
+     pat = os.path.normcase(pat)
+     return fnmatchcase(name, pat)
+ 
  def fnmatchcase(name, pat):
!     """Test whether FILENAME matches PATTERN, including case.
  
+     This is a version of fnmatch() which doesn't case-normalize
+     its arguments.
+     """
+ 
+     if not _cache.has_key(pat):
+         res = translate(pat)
+         _cache[pat] = re.compile(res)
+     return _cache[pat].match(name) is not None
+ 
  def translate(pat):
!     """Translate a shell PATTERN to a regular expression.
! 
!     There is no way to quote meta-characters.
!     """
! 
!     i, n = 0, len(pat)
!     res = ''
!     while i < n:
!         c = pat[i]
!         i = i+1
!         if c == '*':
!             res = res + '.*'
!         elif c == '?':
!             res = res + '.'
!         elif c == '[':
!             j = i
!             if j < n and pat[j] == '!':
!                 j = j+1
!             if j < n and pat[j] == ']':
!                 j = j+1
!             while j < n and pat[j] != ']':
!                 j = j+1
!             if j >= n:
!                 res = res + '\\['
!             else:
!                 stuff = pat[i:j]
!                 i = j+1
!                 if stuff[0] == '!':
!                     stuff = '[^' + stuff[1:] + ']'
!                 elif stuff == '^'*len(stuff):
!                     stuff = '\\^'
!                 else:
!                     while stuff[0] == '^':
!                         stuff = stuff[1:] + stuff[0]
!                     stuff = '[' + stuff + ']'
!                 res = res + stuff
!         else:
!             res = res + re.escape(c)
!     return res + "$"

Index: formatter.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/formatter.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** formatter.py	2000/02/04 15:39:29	1.15
--- formatter.py	2001/01/14 23:36:05	1.16
***************
*** 10,14 ****
  arbitrary, non-exclusive style settings to a writer as well. Additional
  interfaces facilitate formatting events which are not reversible, such as
! paragraph separation. 
  
  Writer objects encapsulate device interfaces. Abstract devices, such as
--- 10,14 ----
  arbitrary, non-exclusive style settings to a writer as well. Additional
  interfaces facilitate formatting events which are not reversible, such as
! paragraph separation.
  
  Writer objects encapsulate device interfaces. Abstract devices, such as
***************
*** 16,20 ****
  implementations all work with abstract devices. The interface makes
  available mechanisms for setting the properties which formatter objects
! manage and inserting data into the output. 
  """
  
--- 16,20 ----
  implementations all work with abstract devices. The interface makes
  available mechanisms for setting the properties which formatter objects
! manage and inserting data into the output.
  """
  

Index: fpformat.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/fpformat.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** fpformat.py	2000/02/04 15:10:32	1.7
--- fpformat.py	2001/01/14 23:36:06	1.8
***************
*** 139,141 ****
      except (EOFError, KeyboardInterrupt):
          pass
- 
--- 139,140 ----

Index: ftplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** ftplib.py	2000/12/12 23:20:44	1.46
--- ftplib.py	2001/01/14 23:36:06	1.47
***************
*** 23,27 ****
  >>> ftp.quit()
  '221 Goodbye.'
! >>> 
  
  A nice test that reveals some of the network dialogue would be:
--- 23,27 ----
  >>> ftp.quit()
  '221 Goodbye.'
! >>>
  
[...1350 lines suppressed...]
!             sys.stderr.write(
!                     "No account -- using anonymous login.")
!     ftp.login(userid, passwd, acct)
!     for file in sys.argv[2:]:
!         if file[:2] == '-l':
!             ftp.dir(file[2:])
!         elif file[:2] == '-d':
!             cmd = 'CWD'
!             if file[2:]: cmd = cmd + ' ' + file[2:]
!             resp = ftp.sendcmd(cmd)
!         elif file == '-p':
!             ftp.set_pasv(not ftp.passiveserver)
!         else:
!             ftp.retrbinary('RETR ' + file, \
!                            sys.stdout.write, 1024)
!     ftp.quit()
  
  
  if __name__ == '__main__':
!     test()