##// END OF EJS Templates
vfs: handle shutil.rmtree deprecation of onerror in Python 3.12...
Mads Kiilerich -
r51647:f173c2c2 stable
parent child Browse files
Show More
@@ -274,7 +274,7 class abstractvfs:
274 274 """
275 275 if forcibly:
276 276
277 def onerror(function, path, excinfo):
277 def onexc(function, path, excinfo):
278 278 if function is not os.remove:
279 279 raise
280 280 # read-only files cannot be unlinked under Windows
@@ -285,10 +285,17 class abstractvfs:
285 285 os.remove(path)
286 286
287 287 else:
288 onerror = None
289 return shutil.rmtree(
290 self.join(path), ignore_errors=ignore_errors, onerror=onerror
291 )
288 onexc = None
289 try:
290 # pytype: disable=wrong-keyword-args
291 return shutil.rmtree(
292 self.join(path), ignore_errors=ignore_errors, onexc=onexc
293 )
294 # pytype: enable=wrong-keyword-args
295 except TypeError: # onexc was introduced in Python 3.12
296 return shutil.rmtree(
297 self.join(path), ignore_errors=ignore_errors, onerror=onexc
298 )
292 299
293 300 def setflags(self, path: bytes, l: bool, x: bool):
294 301 return util.setflags(self.join(path), l, x)
General Comments 0
You need to be logged in to leave comments. Login now