-
-
Notifications
You must be signed in to change notification settings - Fork 318
[bug] negative numbers not parsed as integers from environment variables #799
Copy link
Copy link
Closed
Description
Describe the bug
In version 1.3.9 environment variables that are negative represented as strings (e.g. DYNACONF_NUM="-1") are not cast to type int when loaded in Python. This isn't true in version 1.3.4.
To Reproduce
Steps to reproduce the behavior:
- Having the following folder structure
Project structure
.
├── test.py
└── settings.toml- Having the following config files:
Config files
./settings.toml
num = 1- Having the following app code:
Code
./test.py
from dynaconf import Dynaconf
settings = Dynaconf(settings_file="./settings.toml")
print(settings.num)
print(type(settings.num))- Executing under the following environment
Execution
$ export DYNACONF_NUM="-1"
$ python ./test.pyExpected behavior
The python script should print the following:
-1
<class 'int'>Actual behavior
The python script prints the following:
-1
<class 'str'>Environment (please complete the following information):
- OS: macOS Monerey 12.5.1
- Dynaconf Version [e.g. 3.1.9]
Additional context
Again, this works as expected in version 3.1.4 so I assume something has changed in a recent version.
Reactions are currently unavailable