Handle non-UTF-8 filenames in cache directory when expiring

This commit is contained in:
Kovid Goyal 2019-11-20 08:28:54 +05:30
parent 428957543c
commit d57626c043
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -55,7 +55,10 @@ def robust_rmtree(x):
retries = 2 if iswindows else 1 # retry on windows to get around the idiotic mandatory file locking
for i in range(retries):
try:
rmtree(x)
try:
rmtree(x)
except UnicodeDecodeError:
rmtree(as_bytes(x))
return True
except EnvironmentError:
time.sleep(0.1)