Skip to content

Fix caching for empty dotenv files - #638

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

bbc2 merged 1 commit into
theskumar: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

bbc2 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

This looks like a good change, thanks!

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

Labels

None yet

2 participants