I got to the causing code but I'm not sure how to fix it properly without breaking things. To me it seems that self.write_pre_comment(self.event) on emitter.py:437 should check if it is an empty sequence before writing it, but I am not sure what should be done with that comment and where to put it.
Invalid YAML output with empty array when there is a comment between key and values