yaml_util.restore_yaml_comments has an explicit call to next without catching StopIteration, which is raised if the last processed line is empty or a comment. This seems to happen in Configuration.dump if the last line of config_default.yaml is empty or a comment.