From 29dd0dcd7fce67ccb7fe93376862dfec7e0c8320 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Thu, 27 Nov 2025 15:55:17 -0800 Subject: [PATCH] Document changes for future use --- TODO.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/TODO.md b/TODO.md index 67dc72f18..c719c5951 100644 --- a/TODO.md +++ b/TODO.md @@ -95,6 +95,24 @@ Anything marked with **(!!!)** means a change *will* eventually be required. - [asyncio.run](https://docs.python.org/3.14/library/asyncio-runner.html#asyncio.run) - [asyncio.Runner](https://docs.python.org/3.14/library/asyncio-runner.html#asyncio.Runner) +### Shutil + +#### rmtree + +- `onerror` deprecated and replaced with `onexc` in **Python 3.12** +``` python + def excRemoveReadonly(func, path, exc: Exception): + import stat + shared.log.debug(f'Exception during cleanup: {func} {path} {type(exc).__name__}') + if func in (os.rmdir, os.remove, os.unlink) and isinstance(exc, PermissionError): + shared.log.debug(f'Retrying cleanup: {path}') + os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + func(path) + # ... + try: + shutil.rmtree(found.path, ignore_errors=False, onexc=excRemoveReadonly) +``` + ## Code TODO > npm run todo