Modify ↓
Ticket #113 (new defect)
Changeset 313 dumps reduntant '...' (end of document)
| Reported by: | py4fun@… | Owned by: | xi |
|---|---|---|---|
| Priority: | normal | Component: | pyyaml |
| Severity: | normal | Keywords: | |
| Cc: |
Description
When dumping a simple document (when there is no possibility of ambiguous parsing)
print '"%s"' % yaml.dump("abc")
a redundant "end of document" is emitted:
"abc ... "
Attachments
Change History
comment:2 Changed 4 years ago by anonymous
Sorry, this is the proper diff
-
lib/yaml/emitter.py
1075 1075 end += 1 1076 1076 1077 1077 def write_plain(self, text, split=True): 1078 if self.root_context:1079 self.open_ended = True1080 1078 if not text: 1081 1079 return 1082 1080 if not self.whitespace:
Note: See
TracTickets for help on using
tickets.

This might be halfway intentional, since the description of the commit is: Emit an explicit document end indicator when there is a possibility of ambiguous parsing.
I think that on the root level the caller should be responsible if he uses dumped string in ambiguous way, since he can always request explicit_end.
Removing these lines removes the problem: