Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support subtypes of basic types when encoding (#428)
The current implementation of `TomlEncoder` doesn't support subtypes of the supported basic types. For example: ```py from enum import StrEnum import toml class ValidStrings(StrEnum): FOO = "foo" assert isinstance(ValidStrings.FOO, str) # OK data = {"foo": ValidStrings.FOO} print(toml.dumps(data)) ``` Output: ``` foo = [ "f", "o", "o",] ``` This pull request changes the implementation to use `isinstance` instead of `get(type(...))` to play nice with inheritence. Fixes #418
- Loading branch information