[Python-checkins] python/dist/src/Lib shutil.py,1.25,1.26

jvr@users.sourceforge.net jvr@users.sourceforge.net
Sun, 05 Jan 2003 11:44:13 -0800


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

Modified Files:
	shutil.py 
Log Message:
- squashed bare except in rmtree()
- improved readability of rmtree; removed silly apply()


Index: shutil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** shutil.py	30 Oct 2002 05:44:50 -0000	1.25
--- shutil.py	5 Jan 2003 19:44:11 -0000	1.26
***************
*** 128,142 ****
      cmdtuples = []
      _build_cmdtuple(path, cmdtuples)
!     for cmd in cmdtuples:
          try:
!             apply(cmd[0], (cmd[1],))
!         except:
              exc = sys.exc_info()
              if ignore_errors:
                  pass
              elif onerror is not None:
!                 onerror(cmd[0], cmd[1], exc)
              else:
!                 raise exc[0], (exc[1][0], exc[1][1] + ' removing '+cmd[1])
  
  # Helper for rmtree()
--- 128,142 ----
      cmdtuples = []
      _build_cmdtuple(path, cmdtuples)
!     for func, arg in cmdtuples:
          try:
!             func(arg)
!         except OSError:
              exc = sys.exc_info()
              if ignore_errors:
                  pass
              elif onerror is not None:
!                 onerror(func, arg, exc)
              else:
!                 raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg)
  
  # Helper for rmtree()