summaryrefslogtreecommitdiff
path: root/setuptools/_py312compat.py
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2023-04-19 17:18:27 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2023-04-19 17:18:27 +0100
commitac07f21af8ee73e32448bb0429469b56f412a597 (patch)
treec45e8284ca8668b8aa594deed813145adc1264b8 /setuptools/_py312compat.py
parent245d72a8aa4d47e1811425213aba2a06a0bb64fa (diff)
downloadpython-setuptools-git-ac07f21af8ee73e32448bb0429469b56f412a597.tar.gz
Handle Python3.12a7 compatibility problems
Diffstat (limited to 'setuptools/_py312compat.py')
-rw-r--r--setuptools/_py312compat.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/setuptools/_py312compat.py b/setuptools/_py312compat.py
new file mode 100644
index 00000000..a17d5aec
--- /dev/null
+++ b/setuptools/_py312compat.py
@@ -0,0 +1,11 @@
+import sys
+import shutil
+
+def shutil_rmtree(path, ignore_errors=False, onexc=None):
+ if sys.version_info >= (3, 12):
+ return shutil.rmtree(path, ignore_errors, onexc=onexc)
+
+ def _handler(fn, path, excinfo):
+ onexc(fn, path, excinfo[1])
+
+ return shutil.rmtree(path, ignore_errors, onerror=_handler)