You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variable declared without a value suppresses ${VAR:-default} expansion #750
${A} should still expand to ""; only the defaulted form is affected.
Why this is wrong
The README's "Variable expansion" section lists the resolution order for dotenv_values() as: value of the variable in the .env file, value in the
environment, default value, then empty string. A key written without a value
(A) is documented earlier as producing None, and load_dotenv is said to
"simply ignore such variables" — that is, the variable is unset, not set to the
empty string. Since the default is only skipped when the variable has a value, ${A:-fallback} should produce fallback here.
This also contradicts the explicit distinction the README draws between FOO
and FOO=: A and A= currently expand identically ("") even though only A= is the empty string.
The cause is in Variable.resolve() (src/dotenv/variables.py): a name that is
present in the mapping with a None value is converted to "", so the
supplied default is never used.
Activity