diff options
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | emitter.py | 3 |
2 files changed, 6 insertions, 1 deletions
@@ -54,6 +54,10 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) +NEXT: + - fix empty string mapping key roundtripping with preservation of quotes as `? ''` + (reported via email by Tomer Aharoni). + 0.16.5 (2019-08-18): - allow for ``YAML(typ=['unsafe', 'pytypes'])`` @@ -769,7 +769,8 @@ class Emitter(object): or (isinstance(self.event, MappingStartEvent) and self.event.flow_style is True) or ( isinstance(self.event, ScalarEvent) - and not self.analysis.empty + # if there is an explicit style for an empty string, it is a simple key + and not (self.analysis.empty and self.style and self.style not in '\'"') and not self.analysis.multiline ) or self.check_empty_sequence() |