Accept str subclasses in SafeRepresenter (fixes support of enum.StrEnum)#901
Accept str subclasses in SafeRepresenter (fixes support of enum.StrEnum)#901
str subclasses in SafeRepresenter (fixes support of enum.StrEnum)#901Conversation
|
@nitzmahone could you run CI on this change please? I haven't been able to run the tests locally (they always pick up the installed Edit: I managed to make it work with a little |
|
Also, for anyone coming across this PR: you can work around this bug with this line in your code, before your call to yaml.add_multi_representer(StrEnum, yaml.representer.SafeRepresenter.represent_str) |
For instance, Python 3.11 introduced `enum.StrEnum`, which subclasses `str`, and should be used as such.
|
OK, it now works (and passes all the tests), but it's a new approach that only fixes Given the narrow solution used now, I don't expect any regressions should be possible 😇🤞 |
str subclasses in SafeRepresenter (fixes support of enum.StrEnum)
For instance, Python 3.11 introduced
enum.StrEnum, which subclassesstr, and should be used as such.