Ticket #113 (new defect)

Opened 5 years ago

Last modified 5 years ago

Changeset 313 dumps reduntant '...' (end of document)

Reported by: py4fun@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:


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:



Change History

comment:1 Changed 5 years ago by anonymous

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:

if hints[-1:] == u'+': 
    self.open_ended = True

comment:2 Changed 5 years ago by anonymous

Sorry, this is the proper diff

  • lib/yaml/

    10751075            end += 1 
    10771077    def write_plain(self, text, split=True): 
    1078         if self.root_context: 
    1079             self.open_ended = True 
    10801078        if not text: 
    10811079            return 
    10821080        if not self.whitespace: 

comment:3 Changed 5 years ago by py4fun@…

The issue is: the caller should be responsible for emitting of a redundant 'end of document'. The caller is aware of the context (PyYAML is not). It is not convenient to massage the source code to get rid of unexpected output which reduces readability.


Add a comment

Modify Ticket

Change Properties
<Author field>
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.