Conversation
Lyrics following music via \addlyrics were appended as plain lists directly into the barlist of the current part, so iterating the part crashed with "AttributeError: 'list' object has no attribute 'pickup'". Collect \addlyrics into a LyricsSection and merge it into the preceding music when it ends, as is already done for \lyricsto. This also makes the lyrics appear in the exported MusicXML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ly musicxmlcrashes when a\scorecontains music followed by\addlyrics:(0.9.7 fails the same way with
'list' object has no attribute 'obj_list'.)Root cause
LyricModeinly/musicxml/lymus2musxml.pyonly switched to lyric mode for\addlyrics; unlike\lyricsto, it never set up aLyricsSection. SoMediator.new_lyrics_text()appended each[text, syllabic, nr]list straightinto
self.insert_into.barlist, which at that point is theScorePart. Thepart's barlist then contained plain lists next to
Barobjects, andIterateXmlObjs.iterate_bar()crashed on them.Fix
LyricMode: for\addlyrics, call a newMediator.new_addlyrics_section(),which collects the lyrics in a
LyricsSectionthat remembers the section itfollows.
End: for\addlyrics, call a newMediator.check_addlyrics(), which closesthe last syllable, restores
insert_intoand merges the lyrics into thepreceding music with the existing
ScoreSection.merge_lyrics(). This mirrorshow
\lyricstois already handled.This fixes the crash, and the lyrics now also appear in the exported MusicXML as
<lyric>elements. Before, they were never exported.Tests
tests/test_xml_files/addlyrics.{ly,xml}andtest_addlyricsintests/test_xml.py. The fixture has seven notes and seven syllables, withsingle, begin and end syllables.
test_addlyricsfails with theAttributeError. After the fix,the full suite gives 19 passed and 2 xfailed. The 2 xfails were already there.
Not addressed
\new Lyrics \lyricsto "v" {...}still produces no<lyric>elements insome layouts. Example:
lyricsto-no-lyrics.ly.\new Voice = "x" << \var >> \addlyrics { \lyricvar }withvariables fail with
'NoneType' object has no attribute 'name', and print'ParseSource' object has no attribute 'LayoutContext'and'Keyword'warnings. Minimal example:
voice-variable-addlyrics-crash.ly(the crash is fixed in Create an implicit part for a Voice outside a Staff #197). Real-world source: Brumel, Du tout plongiet, CPDL #19603 (Brumel-DuTout.ly, LilyPond 2.10).These are separate issues and are left for follow-ups.
🤖 Generated with Claude Code