py312compat.py 330 B

123456789101112
  1. import sys
  2. import shutil
  3. def shutil_rmtree(path, ignore_errors=False, onexc=None):
  4. if sys.version_info >= (3, 12):
  5. return shutil.rmtree(path, ignore_errors, onexc=onexc)
  6. def _handler(fn, path, excinfo):
  7. return onexc(fn, path, excinfo[1])
  8. return shutil.rmtree(path, ignore_errors, onerror=_handler)