* :func:`shutil.rmtree` now accepts a new argument *onexc* which is an
error handler like *onerror* but which expects an exception instance
- rather than a *(typ, val, tb)* triplet. *onerror* is deprecated and
- will be removed in Python 3.14.
+ rather than a *(typ, val, tb)* triplet. *onerror* is deprecated.
(Contributed by Irit Katriel in :gh:`102828`.)
* :func:`shutil.which` now consults the *PATHEXT* environment variable to
:mod:`concurrent.futures` the fix is to use a different
:mod:`multiprocessing` start method such as ``"spawn"`` or ``"forkserver"``.
-* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is deprecated and will be removed
- in Python 3.14. Use *onexc* instead. (Contributed by Irit Katriel in :gh:`102828`.)
+* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is deprecated;
+ use *onexc* instead. (Contributed by Irit Katriel in :gh:`102828`.)
* :mod:`sqlite3`:
errors = []
def onerror(*args):
errors.append(args)
- with self.assertWarns(DeprecationWarning):
- shutil.rmtree(link, onerror=onerror)
+ shutil.rmtree(link, onerror=onerror)
self.assertEqual(len(errors), 1)
self.assertIs(errors[0][0], os.path.islink)
self.assertEqual(errors[0][1], link)
errors = []
def onerror(*args):
errors.append(args)
- with self.assertWarns(DeprecationWarning):
- shutil.rmtree(link, onerror=onerror)
+ shutil.rmtree(link, onerror=onerror)
self.assertEqual(len(errors), 1)
self.assertIs(errors[0][0], os.path.islink)
self.assertEqual(errors[0][1], link)
errors = []
def onerror(*args):
errors.append(args)
- with self.assertWarns(DeprecationWarning):
- shutil.rmtree(filename, onerror=onerror)
+ shutil.rmtree(filename, onerror=onerror)
self.assertEqual(len(errors), 2)
self.assertIs(errors[0][0], os.scandir)
self.assertEqual(errors[0][1], filename)
self.addCleanup(os.chmod, self.child_file_path, old_child_file_mode)
self.addCleanup(os.chmod, self.child_dir_path, old_child_dir_mode)
- with self.assertWarns(DeprecationWarning):
- shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror)
+ shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror)
# Test whether onerror has actually been called.
self.assertEqual(self.errorState, 3,
"Expected call to onerror function did not happen.")
self.addCleanup(os.chmod, self.child_file_path, old_child_file_mode)
self.addCleanup(os.chmod, self.child_dir_path, old_child_dir_mode)
- with self.assertWarns(DeprecationWarning):
- shutil.rmtree(TESTFN, onerror=onerror, onexc=onexc)
+ shutil.rmtree(TESTFN, onerror=onerror, onexc=onexc)
self.assertTrue(onexc_called)
self.assertFalse(onerror_called)