##// 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 b' class abstractvfs:'
274 """
274 """
275 if forcibly:
275 if forcibly:
276
276
277 def onerror(function, path, excinfo):
277 def onexc(function, path, excinfo):
278 if function is not os.remove:
278 if function is not os.remove:
279 raise
279 raise
280 # read-only files cannot be unlinked under Windows
280 # read-only files cannot be unlinked under Windows
@@ -285,10 +285,17 b' class abstractvfs:'
285 os.remove(path)
285 os.remove(path)
286
286
287 else:
287 else:
288 onerror = None
288 onexc = None
289 return shutil.rmtree(
289 try:
290 self.join(path), ignore_errors=ignore_errors, onerror=onerror
290 # pytype: disable=wrong-keyword-args
291 )
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 def setflags(self, path: bytes, l: bool, x: bool):
300 def setflags(self, path: bytes, l: bool, x: bool):
294 return util.setflags(self.join(path), l, x)
301 return util.setflags(self.join(path), l, x)
General Comments 0
You need to be logged in to leave comments. Login now