Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions molbloom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def _download_progress(count, block_size, total_size):
def _load_big_filter(name):
# check if it's present
filter_path = os.path.join(_DEFAULT_PATH, f"{name}.bloom")
if not os.path.exists(_DEFAULT_PATH):
os.makedirs(_DEFAULT_PATH)
os.makedirs(_DEFAULT_PATH, exist_ok=True)
Copy link

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes a potential race condition where the directory could be created by another process between the existence check and the makedirs call. The exist_ok=True parameter is the correct approach.

Copilot uses AI. Check for mistakes.
if not os.path.exists(filter_path):
print(f"Starting {name} download to cache directory {_DEFAULT_PATH}")
import urllib.request
Expand Down