aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/cache.py
diff options
context:
space:
mode:
authorAlex Ionescu <aaionescu@protonmail.com>2023-02-17 04:29:32 +0100
committerGitHub <noreply@github.com>2023-02-17 08:59:32 +0530
commitb25d6cb96337d479bdcb41768356da414c3aa835 (patch)
treef613c476785a488784ac8d3e20436304929f585e /yt_dlp/cache.py
parent361630015535026712bdb67f804a15b65ff9ee7e (diff)
downloadhypervideo-pre-b25d6cb96337d479bdcb41768356da414c3aa835.tar.lz
hypervideo-pre-b25d6cb96337d479bdcb41768356da414c3aa835.tar.xz
hypervideo-pre-b25d6cb96337d479bdcb41768356da414c3aa835.zip
[utils] Fix race condition in `make_dir` (#6089)
Authored by: aionescu
Diffstat (limited to 'yt_dlp/cache.py')
-rw-r--r--yt_dlp/cache.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/yt_dlp/cache.py b/yt_dlp/cache.py
index 7be91eae5..f8344fe77 100644
--- a/yt_dlp/cache.py
+++ b/yt_dlp/cache.py
@@ -39,11 +39,7 @@ class Cache:
fn = self._get_cache_fn(section, key, dtype)
try:
- try:
- os.makedirs(os.path.dirname(fn))
- except OSError as ose:
- if ose.errno != errno.EEXIST:
- raise
+ os.makedirs(os.path.dirname(fn), exist_ok=True)
self._ydl.write_debug(f'Saving {section}.{key} to cache')
write_json_file({'yt-dlp_version': __version__, 'data': data}, fn)
except Exception: