]> granicus.if.org Git - python/commitdiff
- Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects
authorGuido van Rossum <guido@python.org>
Wed, 14 Jul 2004 00:48:58 +0000 (00:48 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 14 Jul 2004 00:48:58 +0000 (00:48 +0000)
  the documented behavior: the function passed to the onerror()
  handler can now also be os.listdir.

[I could've sworn I checked this in, but apparently I didn't, or it
got lost???]

Doc/lib/libshutil.tex
Lib/test/test_shutil.py

index a84fca960c30988d0e427cf161348ab0d4b61421..5dd1b6ca289805b08adeef85900d7011e1513966 100644 (file)
@@ -90,7 +90,7 @@ rather than printing a message]{2.3}
   If \var{onerror} is provided, it must be a callable that accepts
   three parameters: \var{function}, \var{path}, and \var{excinfo}.
   The first parameter, \var{function}, is the function which raised
-  the exception; it will be \function{os.remove()} or
+  the exception; it will be \function{os.listdir()}, \function{os.remove()} or
   \function{os.rmdir()}.  The second parameter, \var{path}, will be
   the path name passed to \var{function}.  The third parameter,
   \var{excinfo}, will be the exception information return by
index 05f34d84665689252c85122dee1495bc178e8df9..bcae72f1daca5a5b40561f61005a813bd9438c4f 100644 (file)
@@ -13,6 +13,7 @@ class TestShutil(unittest.TestCase):
         filename = tempfile.mktemp()
         self.assertRaises(OSError, shutil.rmtree, filename)
         self.assertEqual(shutil.rmtree(filename, True), None)
+        shutil.rmtree(filename, False, lambda func, arg, exc: None)
 
     def test_dont_move_dir_in_itself(self):
         src_dir = tempfile.mkdtemp()