Skip to content

Fix caching for empty dotenv files#638

Merged
bbc2 merged 1 commit intotheskumar:mainfrom
ReinerBRO:fix-empty-dotenv-cache
May 8, 2026
Merged

Fix caching for empty dotenv files#638
bbc2 merged 1 commit intotheskumar:mainfrom
ReinerBRO:fix-empty-dotenv-cache

Conversation

@ReinerBRO
Copy link
Copy Markdown
Contributor

Cache the parsed dict even when the dotenv file is empty.

DotEnv.dict() previously used a truthiness check for _dict, so an empty file would be reparsed on every call. This change switches to an explicit is not None guard and adds a regression test that verifies empty dotenv contents are parsed only once.

@bbc2
Copy link
Copy Markdown
Collaborator

bbc2 commented May 8, 2026

This looks like a good change, thanks!

@bbc2 bbc2 merged commit 3f0e3e0 into theskumar:main May 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants